Reputation: 4189
How do you name your docker-compose.yml
files? Is there a convention to follow?
With Dockerfiles <purpose>.Dockerfile
seems to work the best being instantly recognized by VSCode and PyCharm.
I like the idea of structuring docker/compose files into folders so that default names could be used, but as far as I know docker can't see files up the tree creating different problems.
Upvotes: 13
Views: 6412
Reputation: 5205
According to the -f
documentation:
If you don’t provide this flag on the command line, Compose [...] looks for a
docker-compose.yml
and adocker-compose.override.yml
file.
If you don't want to use the -f
flag you can use the default name docker-compose.yml
and override it with docker-compose.override.yml
.
However, if you use -f
, since you'll provide the filename, you can use whatever you want.
I think a good way to name them depending on the environment could be docker-compose.{env}.yml
and place them at the top level directory:
docker-compose.prod.yml
docker-compose.dev.yml
docker-compose.test.yml
docker-compose.staging.yml
And you can use the default docker-compose.yml
to define the base configuration that is common to all environments.
Upvotes: 12