For example with two alpine dockers using inheritance:
You could use printf with a wildcard to specify the files and why not replacing the path by a environment variable, making it at least easier to automatize.
Here, both alp1 and alp2 containers will be targeted.
sudo docker compose $(printf -- '-f %s ' /path/to/project/*.yml) down
/path/to/project/compose.yml
services:
alp2:
extends:
file: alp1.yml
service: alp1
container_name: alp2
/path/to/project/alp1.yml
services:
alp1:
image: alpine
container_name: alp1
command: sleep infinity
I have to add all the config files (and in the right order)
I don't understand why you would have to specify them in a specific order, but if so you can always rename your files for the wildcard to provide them in the order you want: 00_init.yml, 01_env.yml, 02_prod.yml...
Since the project has an associated project name, is there a way I can use it to call commands on it without having to specify the config files, and without having to navigate to the project's directory? If not, is there any other way?
I couldn't find any solution related to project name, but one thing is sure, you wouldn't be able to force docker to look inside all your server for a project config files.