Closed bjoern-arnold closed 1 year ago
The reason it was not done that way is because the new docker compose
command will always return the newer docker compose version even if you are not using it and have it disabled in docker-desktop.
Example:
$ docker compose version --short
2.6.1
$ docker-compose version --short
1.29.2
When you select Use Docker Compose V2 docker-compose
will return the new version:
$ docker-compose version --short
2.6.1
$ docker compose version --short
2.6.1
$ docker version
Client:
Cloud integration: v1.0.24
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:09:02 2022
OS/Arch: windows/amd64
Context: default
Experimental: true
Server: Docker Desktop 4.10.1 (82475)
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:01:23 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.6
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc:
Version: 1.1.2
GitCommit: v1.1.2-0-ga916309
docker-init:
Version: 0.19.0
GitCommit: de40ad0
@bjoern-arnold, are you able to switch back and forth between the old and new docker-compose versions in your environment, and if so how does it report the version being used?
@WadeBarnes no, I'm not abel to switch versions. I assume it's because I've installed Docker Engine only and the new "docker compose" command does not allow switching versions any more (as described e.g. here). My issue is that there is no "docker-compose" command available any more and thus the manage script fails at line 22
In that case it is more appropriate to detect whether the docker-compose
command is available on the system first before detecting the version being used.
Would you like to give that a try and submit a PR?
@WadeBarnes I'm contributing as a Bosch associate and thus I have to get the project approved by our open source officer. This includes an evaluation of the project repo. He found that your policy requires a CONTRIBUTING.md to be present which is not true for this project (see here). Could you please add this file?
Done
Already handled by #239
171 introduced a function to detect the version of docker compose and -depending on the determined version- sets the correct command syntax. However, the version detection assumes that the command is still available as "docker-compose"
dockerComposeVersion=$(docker-compose version --short | sed 's~v~~;s~-.*~~')
This is not the case with my installation (Ubuntu 20.04, Docker version 20.10.16, build aa7e414 with docker-compose plugin v2.5.0). Since Compose V2 went GA in April I suggest to make the new syntax the default for both the dockerCompose variable and the version detection. As a fallback, the old syntax could still be supported by introducing something like: