compose: [BUG] `'version' is obsolete`
Description
After updating to version v2.25.0, the command docker compose pull docker-compose.yaml gives the error 'version' is obsolete
Steps To Reproduce
No response
Compose Version
v2.25.0
Docker Environment
Client: Docker Engine - Community
Version: 24.0.7
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.12.1
Path: /root/.docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.25.0
Path: /root/.docker/cli-plugins/docker-compose
Server:
Containers: 27
Running: 27
Paused: 0
Stopped: 0
Images: 24
Server Version: 24.0.7
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 3dd1e886e55dd695541fdcd67420c2888645a495
runc version: v1.1.10-0-g18a0cb0
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.5.13-1-pve
Operating System: Debian GNU/Linux 12 (bookworm)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 6.723GiB
Name: hpt630
ID: beea869f-20a2-4a3f-a514-6ff0f77b5433
Docker Root Dir: /srv/dev-disk-by-uuid-c1677ca2-07a1-4495-b5c3-ec3f921e2e60/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 14
- Comments: 47 (1 by maintainers)
Commits related to this issue
- fix: Edit docker-compose.yml - Delete version - https://github.com/docker/compose/issues/11628 — committed to bossm0n5t3r/realworld-elixir-phoenix by bossm0n5t3r 3 years ago
- Dropped version info from docker-compose files According to the docker issue 11628 (https://github.com/docker/compose/issues/11628) the 'version' field in docker-compose files is outdated. It shows a... — committed to CrsiX/plane by CrsiX 3 years ago
- Dropped version info from docker-compose files (#4096) According to the docker issue 11628 (https://github.com/docker/compose/issues/11628) the 'version' field in docker-compose files is outdated. ... — committed to makeplane/plane by CrsiX 3 years ago
- docker compose: remove obsolete version property The top-level version property in a compose file is now considered obsolete by the docker project. If its include current docker compose versions outp... — committed to slawr/cdsp by slawr 3 years ago
- docker compose: remove obsolete version property The top-level version property in a compose file is now considered obsolete by the docker project. If its include current docker compose versions outp... — committed to slawr/cdsp by slawr 3 years ago
- docker compose: remove obsolete version property The top-level version property in a compose file is now considered obsolete by the docker project. If its include current docker compose versions outp... — committed to COVESA/cdsp by slawr 3 years ago
- Remove docker compose version as it is now obsolete References: * https://github.com/docker/compose/issues/11628 * https://github.com/compose-spec/compose-spec/blob/master/spec.md#version-and-name-t... — committed to backpackerhh/challenge-be-fintech-disbursements-rails-ddd by backpackerhh 3 years ago
- chore: remove obsolete "version" entry in Docker Compose files References: docker/compose#11628 Signed-off-by: Fletcher Nichol <fletcher@systeminit.com> — committed to systeminit/si by fnichol 3 years ago
- merge: #3552 3552: chore: remove obsolete "version" entry in Docker Compose files r=fnichol a=fnichol References: docker/compose#11628 Co-authored-by: Fletcher Nichol <fletcher@systeminit.com> — committed to systeminit/si by si-bors-ng[bot] 3 years ago
- merge: #3552 3552: chore: remove obsolete "version" entry in Docker Compose files r=fnichol a=fnichol References: docker/compose#11628 Co-authored-by: Fletcher Nichol <fletcher@systeminit.com> — committed to systeminit/si by si-bors-ng[bot] 3 years ago
- services: fix warning 'version' is obsolete see: https://github.com/docker/compose/issues/11628 — committed to Samk13/docker-services-cli by Samk13 3 years ago
- services: fix warning 'version' is obsolete see: https://github.com/docker/compose/issues/11628 — committed to inveniosoftware/docker-services-cli by Samk13 3 years ago
- Removes obsolete `version` directive from docker compose files https://github.com/docker/compose/issues/11628 — committed to electricpulp/docker-magento by michaellehmkuhl 3 years ago
- Remove obsolete "version" key Avoids the console message about `version` being obsolete when running docker compose commands. Further information: https://github.com/docker/compose/issues/11628 — committed to newamericafoundation/newamerica-cms by chigby 3 years ago
- docker compose `version` is obsolete` As per: https://github.com/docker/compose/issues/11628 Therefore we can remove it so we stop getting the warnings from docker Signed-off-by: Taylor Silva <dev@t... — committed to concourse/concourse by taylorsilva 3 years ago
- Remove version: from docker-compose.yml: https://github.com/docker/compose/issues/11628 — committed to dockergiant/rolldev by rbouma2 3 years ago
- chore: Drop version key from Docker Compose files See https://github.com/docker/compose/issues/11628 for more information No functional changes. Part of request #37907 Update dev/build environment ... — committed to Enalean/tuleap by LeSuisse 3 years ago
- Remove `version` field in docker compose file Running `docker compose` command results in `version` is obsolete warning in newer versions. See https://github.com/docker/compose/issues/11628 — committed to solana-playground/solana-playground by acheroncrypto 3 years ago
- Removed 'version' from docker-compose.yml 'version' is obsolete; removed the line to eliminate the warning. https://github.com/docker/compose/issues/11628 — committed to silinternational/mysql-backup-restore by dalenewby 3 years ago
- Remove version: from docker-compose.yml: https://github.com/docker/compose/issues/11628 — committed to dockergiant/rolldev by rbouma2 3 years ago
Could the docs be updated?
As I recall, this isn’t a bug,
versionis only informative since a long time ago now. You can use loose options and you don’t need it, check the spec:https://github.com/compose-spec/compose-spec/blob/master/spec.md#version-and-name-top-level-elements
It’s called proper SDLC. If this was not done, we would have a bloated, unmaintainable mess. So to your question, everyone benefits from it, maintainers and consumers alike. Cleaner code, accurate documentation and expected functionality. I know I sound like a snob (not trying to be one, honestly), and I understand the frustration with having to make changes, but I would say it is part of it.
The new guys obviously don’t think that far ahead into the future.
We can now no longer look at the first like of
docker-compose.ymland understand implicitly how up-to-date it is.version 3.6means something. It means “Supports v3 syntax and Docker 18+”.Removing it removes a lot of important information.
Every change has a cost and a benefit.
My proposal is that if you:
Then that would not lead to ongoing bloat or maintainence burden.
Basically instead of doing that, you’ve had to implement a warning and a deprecation period, and many many thousands of people across the world either have to update their code, or live with the warning.
The APIs that people like the most are the ones that retain backwards compatibility, as that is more user friendly.
I appreciate that making breaking API changes is a common pattern that loads of projects do - but that doesn’t necessarily mean they’re always worth it.
There’s writing on this subject out there if you go looking, eg http://blog.ezyang.com/2016/12/thoughts-about-spec-ulation-rich-hickey/
Sorry to do some action on this obviously closed issue, but i have a Naive question. From a “best practices of programming” point of view, isn’t it always better to be explicit about versioning for the “Just in case” sake?
Thanks, didn’t know that
A warning is appropriate. Just like a compiler emitting a warning for an unused variable. You don’t have to do anything about the unused variable, just like you don’t have to do anything about the
versionfield. But it doesn’t do anything, and hasn’t done anything for years.The only thing changing is that now
docker composehas actual spec validation built-in. It will tell you if any field is there that isn’t in the spec. This includes typos likecnotextunder abuildkey.This is a good thing! So either fix your files, using your bulk editor of choice – including submitting a PR, going through CI, etc – or just ignore the warning. It’s doing literally nothing to hurt you. A warning is an informative message, and it doesn’t matter if it’s labeled “warning” or “info” or anything else.
Please see the documentation link from Xeckt in the first reply. The
versiontop-level element has been deprecated and obsolete indocker composefor some time. The subcommand is now by default using the “default” running mode, where unknown attributes emit a warning, but are ignored. If running in “strict” mode, unknown attributes are an error; and if running in “loose” mode, unknown attributes are ignored and there is no warning. I’m not sure if there are flags implemented yet to run in “strict” or “loose” mode.The file spec accepted by
docker composeis different from the spec accepted bydocker stack. The spec for version 2.x is fordocker compose, and that subcommand is now removingversionas a known attribute; because it is not used. The spec for version 3.x is fordocker stack, and includes the additional attributes for choosing deployment targets in a Docker Swarm cluster. The two specifications are not compatible, but share some history.If you were trying to use the 3.x spec for
docker compose, you were using only the parts that overlapped with the 2.x spec. So, in practice,version: 3.6doesn’t actually mean anything at all, and hasn’t for some time. Becausedocker composehas never implemented the 3.x spec additions.Even with me being on the other side of this preference. I 100% agree with this.
They never needed to care before, their docker-compose files did what they told them to without complaint.
docker compose upcontinued to start the right containers as specifiedand then one day, about 3 months ago, after docker compose automatically updated, it started emitting a warning every time they ran it
oh no! a warning, I’d better go look this up and find out what was important enough to merit adding a warning, and then take the appropriate action to make sure my containers keep starting
But then upon finding out what the warning is about (note that the warning itself isn’t self-describing, it doesn’t say what action should be taken), they find out that oh - nope. Nothing will ever break. The specification for docker-compose says that the version field is allowed but must be ignored. But we still have to either live with the warning, or change every compose file in the world.
A widely used configuration file like this is an API. Changing an API has a cost. I have stated repeatedly in this thread why I believe that cost is far larger than the benefit.
Every response I’ve seen so far has been in the vein of “well the maintainers wanted to, so you should live with it”. And yes, I will live with it, and I’ll change my files as I go along - but that doesn’t mean I shouldn’t politely voice my concerns, attempt to clearly state my reasoning, and hope that the maintainers reconsider - or at least avoid making more changes like this in future.
versionwas declared obsolete as we introduced compose-specification in 2020. It’s been 4 years users would have noticed “compose file format” is not defined by “version 2 vs version 3” antagonism. A warning won’t prevent you to use legacy compose file, will just let you know those are not up-to-date with the state of the art.Last time I checked, that “is” a reason. Might be you do not “agree” with the reason, but it was their prerogative as maintainers. Anyway. As I said, matter of preference and opinion.
If it’s informative, shouldn’t it NOT output “WARN”? I don’t expect most users interpret WARN as strictly informational.
Love that it is gone. It was so obsolete, last week I was wondering why it is not increasing like everything in life, and now it is gone.
I have the same question. How is this going to work…there are definitely differences between 2.x and 3.x that are not compatible with one another?
There’s a lot of files affected, changing across the various repositories requires commits, PRs, CI runs, approvals etc etc etc
Here’s how many public files github search thinks are affected. The number of private files is likely much larger https://github.com/search?q=“version%3A”+language%3Ayaml+path%3Adocker-compose+&type=code
Example code from docker’s own github org still contains the version field: https://github.com/search?q=“version%3A”+language%3Ayaml+path%3Adocker-compose+org%3Adocker&type=code
All of this churn and work and discussion and waste is being created… for what gain?
@bkraul The full question was about hiding without editing many files.
I bet this move is to piss off the podman compose files users and stand out from that XD (it is a joke)
Odd to warn for a version value. I would have left it optional instead of deprecating it. For some people it might have a purpose.
I am going to guess ignoring it would not be proper cleanup. This is a deprecation. Deprecations carry warnings before the removal of the feature. It is saying at some point this will generate errors, so clean it up.