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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With