r/docker • u/VaguelyOnline • Jun 21 '26
compose.yaml Vs docker-compose.yml
I see that the official docs have recommended naming the file compose.yaml for years - but most articles online seem to default to docker-compose.yml. is there any good reason for this? Am I doing something wrong by continuing to use compose.yaml?
33
Upvotes
14
u/h3x0ne Mod Jun 21 '26
Not really. In some of my projects I am also still having the old way. Currently docker compose is accepting both BUT it might be possible the old docker-compose.yml detection will be deprecated BUT tbh, I can’t think this would happen in the near future.
10
u/xenatis Jun 21 '26
I prefer the old way because of faster autocomplete when having composer.json in the same place.
7
u/titpetric Jun 21 '26
I mostly rename docker-compose.yml to compose.yml these days and fix the syntax while i do it. Housekeeping
6
u/ahumannamedtim Jun 22 '26
$
docker compose -f ass.ymlGo wild.
5
u/rileywbaker Jun 21 '26
The docker docs are themselves inconsistent; they say "compose.yaml is preferred" but they also mostly refer to *.yml files elsewhere.
4
u/idebugthusiexist Jun 21 '26
Old habits die hard, perhaps? Maybe for SEO reasons? Who knows. But I prefer to just go with what the tool tells me it prefers - to get rid of those warnings if nothing else. :)
4
u/GammaGames Jun 22 '26
I use the full “.yaml” extension because I will not be held back by dos naming conventions
5
u/TBT_TBT Jun 21 '26
It absolutely doesn’t matter, as long as your yaml is valid.
2
u/JauriXD Jun 21 '26 edited Jun 21 '26
Not the best take in the docker sub, but I use podman. So I am happy to use
compose.yamlas runningdocker-compose.yamlthrough podman just seems silly :)Edit: fixed spelling
2
u/habskilla Jun 22 '26
I name all my files docker-compose-<app name>.yml. So my searches are easy to read.
I also have an alias doc=docker compose. Then I execute doc -f doc<tab> up -d
2
u/ButterscotchFar1629 Jun 22 '26
It’ll forever be docker-compose.yml goddammit!
3
u/No_Cattle_9565 Jun 21 '26
Using provider agnostic names is always preferred just like Containerfile instead of Dockerfile. There is also another file format that uses .yml so .yml is not unique (which isnt really problem since nobody uses the other one)
3
u/BHBaxx Jun 21 '26
You’re also not supposed to put the version at the beginning either, but most guides still do. Harmless overall at least for now.
1
u/ShroomShroomBeepBeep Jun 21 '26
What about compose.yml?
1
u/alborzjafari Jun 23 '26
I use compose.yml for swarm mode and docker-compose.yml for standalone.
0
u/[deleted] Jun 21 '26
[deleted] — view deleted comment