-
Notifications
You must be signed in to change notification settings - Fork 614
Use v2 as default for Docker Compose version #621
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
Changes from all commits
7c18c61
4754e5b
5a770c5
ef557fd
35b9bd7
12c446c
1c084da
78c9082
4241686
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,7 @@ source dev-container-features-test-lib | |
| check "docker-buildx" docker buildx version | ||
| check "docker-build" docker build ./ | ||
|
|
||
| check "installs docker-compose v1 install" bash -c "type docker-compose" | ||
| check "installs compose-switch" bash -c "[[ -f /usr/local/bin/compose-switch ]]" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You would be able to revert these changes after you add back compose switch installation! |
||
| check "installs docker-compose v2 install" bash -c "type docker-compose" | ||
|
|
||
| # Report result | ||
| reportResults | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| # Optional: Import test library | ||
| source dev-container-features-test-lib | ||
|
|
||
| # Definition specific tests | ||
| check "docker-buildx" docker buildx version | ||
| check "docker-build" docker build ./ | ||
|
|
||
| check "not installing compose skips docker-compose v2 install" bash -c "! type docker-compose" | ||
|
|
||
| # Report result | ||
| reportResults |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,7 @@ source dev-container-features-test-lib | |
| check "docker-buildx" docker buildx version | ||
| check "docker-build" docker build ./ | ||
|
|
||
| check "not installing compose skips docker-compose v1 install" bash -c "! type docker-compose" | ||
| check "not installing compose skips compose-switch" bash -c "[[ ! -f /usr/local/bin/compose-switch ]]" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here! ^ |
||
| check "not installing compose skips docker-compose v2 install" bash -c "! type docker-compose" | ||
|
|
||
| # Report result | ||
| reportResults | ||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,7 +49,8 @@ | |
| "image": "mcr.microsoft.com/devcontainers/base:ubuntu-20.04", | ||
| "features": { | ||
| "docker-outside-of-docker": { | ||
| "moby": true | ||
| "moby": true, | ||
| "dockerDashComposeVersion": "v2" | ||
| } | ||
| }, | ||
| "containerUser": "vscode" | ||
|
|
@@ -76,26 +77,6 @@ | |
| }, | ||
| "containerUser": "vscode" | ||
| }, | ||
| "docker_dash_compose_v1": { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Can we add a test scenario which validates specific version/semver changes? Thanks! |
||
| "image": "mcr.microsoft.com/devcontainers/base:ubuntu-20.04", | ||
| "features": { | ||
| "docker-outside-of-docker": { | ||
| "moby": false, | ||
| "dockerDashComposeVersion": "v1" | ||
| } | ||
| }, | ||
| "containerUser": "vscode" | ||
| }, | ||
| "docker_dash_compose_v1_moby": { | ||
| "image": "mcr.microsoft.com/devcontainers/base:ubuntu-20.04", | ||
| "features": { | ||
| "docker-outside-of-docker": { | ||
| "moby": true, | ||
| "dockerDashComposeVersion": "v1" | ||
| } | ||
| }, | ||
| "containerUser": "vscode" | ||
| }, | ||
| "docker_dash_compose_v2": { | ||
| "image": "mcr.microsoft.com/devcontainers/base:ubuntu-20.04", | ||
| "features": { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep the installation for docker compose-switch?
Reasoning: As tools will still use
docker-compose, hence, we need a mapping. We could either use this switch or create an alias (like Docker desktop). For ease, we can keep the installation code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand the need for
compose-switch, based on it's descriptionDuring the installation, it already installs
docker-compose-pluginfrom APT which enables$ docker compose, the part I'm updating installs https://github.com/docker/compose a.k.a Docker Compose v2 into/usr/local/bin/docker-composeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installing docker compose v2 is perfect and that's what is required. In this context of the comment, it provides the
docker composecommand (notice the space here)With the PR changes, tools/scripts which still use the
docker-composecommand (which was provided by v1) will fail. We don't have to install v1 to serve this scenario, however, we need to make sure thatdocker-composecommand (notice the hyphen here) works.We can achieve this by either installing the docker-compose switch or by adding a new alias. Even v2 Docker Desktop supports the use of
docker-composecommand (they use aliasing, so aliasing or compose switch anything is fine). So it feels right to add this support in the Feature as well.Feel free to raise any questions/concerns!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, maybe I didn't articulate my point properly in my previous comment. I still don't think compose-switch is required here.
During installation, either
docker-compose-pluginormoby-composeis installed from APT depending onif [ "${USE_MOBY}" = "true" ], this enables the use of$ docker composeBut also during installation,
if [ "${DOCKER_DASH_COMPOSE_VERSION}" != "none" ], then it installs https://github.com/docker/compose, which to my understanding is actually the same binary as the package from APT, and this is installed into/usr/local/bin/docker-compose, so they are functionally the same, the difference being installation methodPackaged: https://docs.docker.com/compose/install/linux/#install-using-the-repository
VS
Manual: https://docs.docker.com/compose/install/standalone/
Which actually raises the question, is this step even required? Instead, is the right approach just to add an alias
alias docker-compose='docker compose'?Note:
Running the installation script with defaults results in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation.
Yep, aliasing should be fine as well 👍