Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 'version' is obsolete #11628

Closed
frepke opened this issue Mar 15, 2024 · 47 comments
Closed

[BUG] 'version' is obsolete #11628

frepke opened this issue Mar 15, 2024 · 47 comments

Comments

@frepke
Copy link

frepke commented Mar 15, 2024

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

@frepke frepke changed the title version is obsolete 'version' is obsolete Mar 15, 2024
@frepke frepke changed the title 'version' is obsolete BUG: 'version' is obsolete Mar 15, 2024
@frepke frepke changed the title BUG: 'version' is obsolete [BUG] 'version' is obsolete Mar 15, 2024
@Xeckt
Copy link

Xeckt commented Mar 15, 2024

As I recall, this isn't a bug, version is 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

@frepke
Copy link
Author

frepke commented Mar 15, 2024

As I recall, this isn't a bug, version is 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

Thanks, didn't know that

@frepke frepke closed this as completed Mar 15, 2024
@frepke
Copy link
Author

frepke commented Mar 15, 2024

@Xeckt gave the answer

@HenriWahl
Copy link

How will docker-compose.yml files for versions 2.x and 3.x be distinguished without the version tag?

@bkraul
Copy link

bkraul commented Mar 22, 2024

How will docker-compose.yml files for versions 2.x and 3.x be distinguished without the version tag?

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?

@luciangabor
Copy link

The version had (and in one case still has) a very ... limited relevance. It's purpose was to ... limit what you were allowed to write in those yaml files. The only case where that's still "relevant" is for docker stack.

The current file format is more of a "descendant" of the 2.x series and the 3.x series is, again, only relevant for docker stack, where 2.x had no ... relevance.

I'm glad it's gone. It was tiring to see "3" as version

@rseymour
Copy link

Could the docs be updated?

@GrimalDev
Copy link

Could the docs be updated?

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?

CrsiX added a commit to CrsiX/plane that referenced this issue Mar 31, 2024
According to the docker issue 11628
(docker/compose#11628)
the 'version' field in docker-compose files is outdated.
It shows a warning like the following on hosts with a newer
Docker version:

```
WARN[0000] /srv/plane/docker-compose.yaml: `version` is obsolete
```

Also, the specs itself state the version was only informative:
https://github.com/compose-spec/compose-spec/blob/master/spec.md#version-and-name-top-level-elements

> The top-level `version` property is defined by the Compose
> Specification for backward compatibility. It is only informative.
> Compose doesn't use version to select an exact schema to
> validate the Compose file, but prefers the most recent schema
> when it's implemented.
sriramveeraghanta pushed a commit to makeplane/plane that referenced this issue Apr 4, 2024
According to the docker issue 11628
(docker/compose#11628)
the 'version' field in docker-compose files is outdated.
It shows a warning like the following on hosts with a newer
Docker version:

```
WARN[0000] /srv/plane/docker-compose.yaml: `version` is obsolete
```

Also, the specs itself state the version was only informative:
https://github.com/compose-spec/compose-spec/blob/master/spec.md#version-and-name-top-level-elements

> The top-level `version` property is defined by the Compose
> Specification for backward compatibility. It is only informative.
> Compose doesn't use version to select an exact schema to
> validate the Compose file, but prefers the most recent schema
> when it's implemented.
@tim-kilian
Copy link

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.

stsewd added a commit to readthedocs/common that referenced this issue Jun 4, 2024
- Version is no longer needed (docker/compose#11628)
- The version of postgres doesn't work with the latest version of
  docker for some reason, puling that image results in
  `layers from manifest don't match image configuration`.
stsewd added a commit to readthedocs/common that referenced this issue Jun 5, 2024
- Version is no longer needed (docker/compose#11628)
- The version of postgres doesn't work with the latest version of
  docker for some reason, puling that image results in
  `layers from manifest don't match image configuration`.
@twkonefal
Copy link

As I recall, this isn't a bug, version is 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

If it's informative, shouldn't it NOT output "WARN"? I don't expect most users interpret WARN as strictly informational.

@Xeckt
Copy link

Xeckt commented Jun 6, 2024

As I recall, this isn't a bug, version is 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

If it's informative, shouldn't it NOT output "WARN"? I don't expect most users interpret WARN as strictly informational.

That depends on how you interpret it. It ensures the user pays attention to it, because they might use version expecting some sort of behavioural difference.

@speller
Copy link

speller commented Jun 17, 2024

BTW, how to hide this message? Our environment is built from multiple docker-compose files. Sometimes we have to use docker-compose commands extensively. So it may print a few screens of the warning like this:

image

This is a light version of the output, actually.

How to hide these annoying messages except by editing many files at once?

@bkraul
Copy link

bkraul commented Jun 17, 2024

BTW, how to hide this message? Our environment is built from multiple docker-compose files. Sometimes we have to use docker-compose commands extensively. So it may print a few screens of the warning like this:

yeah! remove the version: tag from your compose files! 😄

@speller
Copy link

speller commented Jun 18, 2024

@bkraul The full question was about hiding without editing many files.

@bkraul
Copy link

bkraul commented Jun 18, 2024

@speller, OK what is the impediment to batch-modifying the many files? if in Windows, Notepad++ can instantly and safely (with preview) remove those lines. Or if you use a Mac, I am sure you can find a tool to use in that "glorious" ecosystem.

If in Linux (or mac cli), sed is your friend...one-liner. 2 if you want to play it safe. You execute them in the root path where all your files are (even if in subdirs, I am assuming all are in /home/alex/projects)

For finding the files (with line number of the occurrence) that will be affected:

grep -rn "^version:"

For applying the removal of the lines with version: tag:

find -iname "docker-compose.yml" | xargs sed -i '/^version:/d'

But again, sorry, I still don't see the issue here.

@glenjamin
Copy link

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=%22version%3A%22+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=%22version%3A%22+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?

@rseymour
Copy link

Right if step 1 was set to warning, is step 2 not allow docker-compose.yml files with the version field to run? It seems like an INFO level item at best. The change seemed to forget about the long tail of documentation and use cases outside of the core team. Folks following docs like this: https://code.visualstudio.com/docs/containers/docker-compose will be seeing a warning for no good reason, other than an allergy to painless backwards compatibility.

@Xeckt
Copy link

Xeckt commented Jun 18, 2024

All of this churn and work and discussion and waste is being created... for what gain?

While there is a lot of files effected, it really doesn't change anything for the people who have it, it's just a simple warning to show it's obsolete so it's not actually doing anything by being there or not being there. So it's necessary to not have it, there's no major gain out of it. What is the use of it being there if it's not being used anyway? Would you rather it's there just for show?

@bkraul
Copy link

bkraul commented Jun 18, 2024

@Xeckt exactly. I see a lot of people complaining that they see a warning, and then turn around and complain that it is too much work to change the files to stop the warning. Clearly the thought process is that the tool that is deprecating this for a reason needs to just make changes to accomodate for this preference. Sorry, I know it ruffles feathers and such, but oh well.

We are experiencing a massive situation with Chrome removing support for third-party cookies (specifically with Okta). We could sit and complain about "how much work will it be to re-implement to allow for this change", and try to get Google to back-track on the change, or we could actually do it, and have our applications be all the better for it. anyway, matter of preference.

@glenjamin
Copy link

t's not actually doing anything by being there or not being there. So it's necessary to not have it, there's no major gain out of it.

This exact argument works in reverse. If it doesn't matter, why introduce a warning at all?

Everyone who sees the warning for the first time now has to wonder if it's important, look it up, read this thread, and decide whether to take action or live with the warning.

Clearly the thought process is that the tool that is deprecating this for a reason

No reason has ever been presented other than "it makes things a bit tidier".

We are experiencing a massive situation with Chrome removing support for third-party cookies

Third party cookie changes are generally about trying to improve consumer privacy. If you disagree with such changes then you should definitely voice those concerns to the vendors.

Adding a warning for the presence of a field that doesn't do anything either way is not at all comparable.

@rseymour
Copy link

It should be INFO not a WARN if it doesn't affect anything. That's the basic issue here, a typo in the original PR that made an informative log line into a warning.

@bkraul
Copy link

bkraul commented Jun 18, 2024

Clearly the thought process is that the tool that is deprecating this for a reason

No reason has ever been presented other than "it makes things a bit tidier".

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.

@rseymour
Copy link

@bkraul
Copy link

bkraul commented Jun 18, 2024

compose-spec/compose-go#640

Yep, and you saw the resolution of that by one of the contributors...So unless I am missing something, this was not a "typo in the original PR"

I agree with @ndeloof, if we keep this as a simple message users will continue to use it and being confused when they will open issues about the file version v2 vs v3, and even sometimes with the Compose binary version itself. A warning message make it clear, it supposes you'll take action on your side if you don't want to be bother by the message again

@Xeckt
Copy link

Xeckt commented Jun 18, 2024

This exact argument works in reverse. If it doesn't matter, why introduce a warning at all?

Because people will use the version tag thinking it's actually doing something. The warning is there to show you it's not doing anything.

Everyone who sees the warning for the first time now has to wonder if it's important, look it up, read this thread, and decide whether to take action or live with the warning.

This is a normal process for any software involving changes and updates.

No reason has ever been presented other than "it makes things a bit tidier".

https://github.com/compose-spec/compose-spec/blob/master/spec.md#version-and-name-top-level-elements

@wmorrell
Copy link

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 version field. But it doesn't do anything, and hasn't done anything for years.

The only thing changing is that now docker compose has actual spec validation built-in. It will tell you if any field is there that isn't in the spec. This includes typos like cnotext under a build key.

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.

@ndeloof
Copy link
Contributor

ndeloof commented Jun 18, 2024

version was 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.

@glenjamin
Copy link

version was 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.

I would suggest that the majority of users of docker compose files were not aware of these specification changes, nor would they care. Adding this warning has effectively forced a bunch of people to learn about these subtlties. For your project perhaps this is a desirable goal? But please take some time to consider the ecosystem impact from making platform-level changes like this - especially on a project that has had an excellent backwards compatibility record for many many years.

The only thing changing is that now docker compose has actual spec validation built-in. It will tell you if any field is there that isn't in the spec. This includes typos like cnotext under a build key.

This is great! But there is nothing about spec validation in general that requires a warning about usage of the version key. The specification even mentions the version field used to be important but is no longer in use. Considering it obsolete was only actually documented in the specification 2 months ago in compose-spec/compose-spec#489 - which is a whole month after this issue was opened!

@bkraul
Copy link

bkraul commented Jun 18, 2024

I would suggest that the majority of users of docker compose files were not aware of these specification changes, nor would they care. Adding this warning has effectively forced a bunch of people to learn about these subtlties. For your project perhaps this is a desirable goal? But please take some time to consider the ecosystem impact from making platform-level changes like this - especially on a project that has had an excellent backwards compatibility record for many many years.

Help me understand somthing here. You are saying the majority of users were not aware or do not care, but all of the sudden the particular warning behavior is deemed critical and the mantainers must pull it back? If they "don't care" as you say, why should they care about the warning, which is something someone already mentioned here.

@glenjamin
Copy link

Help me understand somthing here. You are saying the majority of users were not aware or do not care, but all of the sudden the particular warning behavior is deemed critical and the mantainers must pull it back? If they "don't care" as you say, why should they care about the warning, which is something someone already mentioned here.

They never needed to care before, their docker-compose files did what they told them to without complaint.

docker compose up continued to start the right containers as specified

and 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.

@bkraul
Copy link

bkraul commented Jun 18, 2024

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.

Even with me being on the other side of this preference. I 100% agree with this.

@docker docker locked as too heated and limited conversation to collaborators Jun 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests