Home > Software design >  Does it matter if the docker compose file is named docker-compose.yml or compose.yml?
Does it matter if the docker compose file is named docker-compose.yml or compose.yml?

Time:11-04

Looking at examples for docker compose files I found some named "compose.y(a)ml" instead of "docker compose.yml" or "docker-compose.yml" that I've seen. Does it matter if it's "compose." or "docker composer"? Awesome Compose repo

I've tried to search for an answer online and tried reading on the docker documentation here but didn't figure it out. https://docs.docker.com/compose/reference/

Thank you

CodePudding user response:

If the file is named exactly docker-compose.yml, running docker-compose with no other options will find it. Otherwise, you must pass a docker-compose -f option with the alternate name, for every docker-compose command.

Style-wise, I'd recommend putting a file named exactly docker-compose.yml (and possibly a matching docker-compose.override.yml with developer-oriented settings) in your repository's root directory. If you're building a custom image, also put the Dockerfile (again, with exactly that name and capitalization) in the repository root directory.

  • Related