Closed NickLambellGCH closed 2 years ago
Hi @NickLambellGCH,
whereas my result from
docker compose version --short
is2.6.0
with no leadingv
Docker Compose exists into two flavours:
v1
, which is currently "deprecated":
Only high-priority security patches and critical bug fixes will apply to V1 until the next milestone
v2
, which is "quite" new and based on GoThe version of the supported Docker Compose file version is unrelated to the CLI command version.
That being said, it looks like you are actually running v2
since you're running docker compose version
and not docker-compose version
i.e. w/o the dash.
https://www.docker.com/blog/announcing-compose-v2-general-availability/ tells:
When is Compose V2 GA and what does it mean?
April 26, 2022 marks the GA of Docker Compose V2. Starting today, Compose V2 is the standard across all documentation, and Compose V2 will become the developer default on Docker Desktop. However, you can continue aliasing
docker-compose
todocker compose
and opt-out of V2 via the Docker Desktop UI — or by entering thedocker-compose disable-v2
command.What do I need to do as a developer?
In most cases, you won’t need to do anything. Docker Desktop versions 3.4+ have Compose V2 installed automatically. On Docker Desktop version 4.4.2+, we enable aliasing of
docker-compose
syntax todocker compose
by default. This lets you use V2 as a drop-in replacement for V1 while requiring minimal (if any) updates to your scripts.
https://github.com/docker/compose/blob/9054f6a18b51ff4b7eb5ca669275eceaf9cdc12d/cmd/compose/version.go#L54-L64 actually tells that --short
will remove the leading v
.
Could you report here the output of the following commands on your environment:
docker compose version --short
docker compose version
?
/cc @kabalin
TIA, Matteo
Hi @scara,
Thanks for the quick reply! On my environment I get the following:
docker compose version --short
: 2.6.0
docker compose version
: Docker Compose version v2.6.0
After posting this earlier I created a fork with detection for my version format just to test and it has been running all day without any troubles, https://github.com/moodlehq/moodle-docker/compare/master...NickLambellGCH:master.
Hi @NickLambellGCH, thanks for your reply.
Would you mind to create a PR based on your https://github.com/moodlehq/moodle-docker/compare/master...NickLambellGCH:master which IMHO should be improved to just test $ver =~ ^2
since the first output is trashed to check for the availability of v2
and it actually uses the output from the short
option?
TIA, Matteo
Thanks for reporting @NickLambellGCH, in my case the output is:
1000 ruslan@debian:~> docker compose version --short
v2.2.3
We should improve regex to consider v
as optional (=~ ^v?2
or the way you suggested), feel free to send PR.
We should improve regex to consider v as optional ( =~ ^v?2 or the way you suggested), feel free to send PR.
+1
For the record: https://github.com/docker/compose/commit/99cd90a4b2f129e794fd34d0cf699078bbc2161b i.e. short
option changed since 2.3.0
: https://github.com/docker/compose/pull/9096.
Hey all, I've gone ahead and submitted #216 to resolve this. Thanks for the discussion and feedback.
Hi Team,
Each time I run
moodle-docker-compose
I am prompted with "Compose v2 is not available in Docker CLI, falling back to use docker-compose script". This appears to be due to the check at moodle-docker-compose#L29 checking that the version starts withv2
whereas my result fromdocker compose version --short
is2.6.0
with no leading v. I'm not sure if this is the case for a standalone Docker installation as I'm running this on WSL2 (Ubuntu 20.04.4) under windows 10 with Docker Desktop providing Docker via their WSL Integration.