remove version top-level element in the compose.yml file
What problem does this PR solve?
- remove version top-level element in the compose.yml file
when use command
docker compose -f docker-compose-CN.yml up -d,it will waring,maybe it appear after v25,5
ref to https://docs.docker.com/compose/intro/history/#docker-compose-cli-versioning
Version one of the Docker Compose command-line binary was first released in 2014. It was written in Python, and is invoked with docker-compose. Typically, Compose V1 projects include a top-level version element in the compose.yml file, with values ranging from 2.0 to 3.8, which refer to the specific file formats.
Version two of the Docker Compose command-line binary was announced in 2020, is written in Go, and is invoked with docker compose. Compose V2 ignores the version top-level element in the compose.yml file.
Also in README.MD show Docker >= 24.0.0 & Docker Compose >= v2.26.1. so i want to remove the version.
Type of change
- [x] Other (please describe): remove warning
If we removed this line, all the 'docker-compose' users can't compile this ymal, can they?
If we removed this line, all the 'docker-compose' users can't compile this ymal, can they?
For just remove the line , it deepends on the Compose files‘s version, As website say Version 2 files are supported by Compose 1.6.0+ and require a Docker Engine of version 1.10.0+.. I think the newer version of docker-compose can compile this ymal. And in my machine , i use the v1.29.2-1 and compile correctly.
And for this projects, we have the requirement for Docker Compose >= v2.26.1, (may be for seperate the yml to base.yml and use include) . In my test,docker-compose up have wrong with include.
ERROR: The Compose file './docker-compose.yml' is invalid because:
'include' does not match any of the regexes: '^x-'
Is there any chance that people use "docker-compose" can compile it if keep the version line.
Is there any chance that people use "docker-compose" can compile it if keep the version line.
yes, if we not use include(support after Docker Compose version 2.20.0) attributes, docker-compose will compile it.
If we removed this line, all the 'docker-compose' users can't compile this ymal, can they?
For just remove the line , it deepends on the Compose files‘s version, As website say
Version 2 files are supported by Compose 1.6.0+ and require a Docker Engine of version 1.10.0+.. I think the newer version of docker-compose can compile this ymal. And in my machine , i use the v1.29.2-1 and compile correctly.
I could be wrong about what I just said.
The Compose Specification is the latest and recommended version of the Compose file format.The top-level version property is defined by the Compose Specification for backward compatibility. It is only informative and optional.It is implemented in versions 1.27.0 and above (also known as Compose V2) of the Docker Compose CLI.
so v1.27.0 and above can compile it