Skip to content

Commit 97fccab

Browse files
authored
[docker-in-docker] - Fix for multiple vulnerability issues related to docker compose-switch component. (#1541)
* [docker-in-docker] - Fix for multiple vulnerability issues related to docker compose-switch component. * Corrections in test scripts as per review comment.
1 parent e9cfd3f commit 97fccab

9 files changed

Lines changed: 46 additions & 8 deletions

File tree

src/docker-in-docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Create child containers *inside* a container, independent from the host's docker
2222
| azureDnsAutoDetection | Allow automatically setting the dockerd DNS server when the installation script detects it is running in Azure | boolean | true |
2323
| dockerDefaultAddressPool | Define default address pools for Docker networks. e.g. base=192.168.0.0/16,size=24 | string | - |
2424
| installDockerBuildx | Install Docker Buildx | boolean | true |
25-
| installDockerComposeSwitch | Install Compose Switch (provided docker compose is available) which is a replacement to the Compose V1 docker-compose (python) executable. It translates the command line into Compose V2 docker compose then runs the latter. | boolean | true |
25+
| installDockerComposeSwitch | Install Compose Switch (provided docker compose is available) which is a replacement to the Compose V1 docker-compose (python) executable. It translates the command line into Compose V2 docker compose then runs the latter. | boolean | false |
2626
| disableIp6tables | Disable ip6tables (this option is only applicable for Docker versions 27 and greater) | boolean | false |
2727

2828
## Customizations

src/docker-in-docker/devcontainer-feature.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "docker-in-docker",
3-
"version": "2.13.0",
3+
"version": "2.14.0",
44
"name": "Docker (Docker-in-Docker)",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-in-docker",
66
"description": "Create child containers *inside* a container, independent from the host's docker instance. Installs Docker extension in the container along with needed CLIs.",
@@ -53,7 +53,7 @@
5353
},
5454
"installDockerComposeSwitch": {
5555
"type": "boolean",
56-
"default": true,
56+
"default": false,
5757
"description": "Install Compose Switch (provided docker compose is available) which is a replacement to the Compose V1 docker-compose (python) executable. It translates the command line into Compose V2 docker compose then runs the latter."
5858
},
5959
"disableIp6tables": {

src/docker-in-docker/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ AZURE_DNS_AUTO_DETECTION="${AZUREDNSAUTODETECTION:-"true"}"
1616
DOCKER_DEFAULT_ADDRESS_POOL="${DOCKERDEFAULTADDRESSPOOL:-""}"
1717
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
1818
INSTALL_DOCKER_BUILDX="${INSTALLDOCKERBUILDX:-"true"}"
19-
INSTALL_DOCKER_COMPOSE_SWITCH="${INSTALLDOCKERCOMPOSESWITCH:-"true"}"
19+
INSTALL_DOCKER_COMPOSE_SWITCH="${INSTALLDOCKERCOMPOSESWITCH:-"false"}"
2020
MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
2121
MICROSOFT_GPG_KEYS_ROLLING_URI="https://packages.microsoft.com/keys/microsoft-rolling.asc"
2222
DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="trixie bookworm buster bullseye bionic focal jammy noble"

test/docker-in-docker/docker_build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ source dev-container-features-test-lib
99
check "docker-buildx" docker buildx version
1010
check "docker-build" docker build ./
1111

12-
check "installs compose-switch" bash -c "[[ -f /usr/local/bin/compose-switch ]]"
1312
check "docker compose" bash -c "docker compose version | grep -E '2.[0-9]+.[0-9]+'"
1413
check "docker-compose" bash -c "docker-compose --version | grep -E '2.[0-9]+.[0-9]+'"
1514

1615
check "docker-buildx" bash -c "docker buildx version"
1716
check "docker-buildx-path" bash -c "ls -la /usr/libexec/docker/cli-plugins/docker-buildx"
1817

18+
check "Not installing compose-switch by default" bash -c "[[ ! -f /usr/local/bin/compose-switch ]]"
19+
1920
# Report result
2021
reportResults
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Optional: Import test library
6+
source dev-container-features-test-lib
7+
8+
# Definition specific tests
9+
check "docker-buildx" docker buildx version
10+
check "docker-build" docker build ./
11+
12+
check "docker compose" bash -c "docker compose version | grep -E '2.[0-9]+.[0-9]+'"
13+
check "docker-compose" bash -c "docker-compose --version | grep -E '2.[0-9]+.[0-9]+'"
14+
15+
check "docker-buildx" bash -c "docker buildx version"
16+
check "docker-buildx-path" bash -c "ls -la /usr/libexec/docker/cli-plugins/docker-buildx"
17+
18+
check "installs compose-switch as the flag is on" bash -c "[[ -f /usr/local/bin/compose-switch ]]"
19+
20+
# Report result
21+
reportResults
22+

test/docker-in-docker/docker_buildx.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ check "docker-buildx" docker buildx version
1313
check "docker-build" docker build ./
1414

1515
check "installs docker-compose v1 install" bash -c "type docker-compose"
16-
check "installs compose-switch" bash -c "[[ -f /usr/local/bin/compose-switch ]]"
16+
17+
check "Not installing compose-switch by default" bash -c "[[ ! -f /usr/local/bin/compose-switch ]]"
1718

1819
# Report result
1920
reportResults

test/docker-in-docker/docker_compose_v2.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ source dev-container-features-test-lib
1010
check "docker compose" bash -c "docker compose version | grep -E '2.[0-9]+.[0-9]+'"
1111
check "docker-compose" bash -c "docker-compose --version | grep -E '2.[0-9]+.[0-9]+'"
1212
check "installs compose-switch as docker-compose" bash -c "[[ -f /usr/local/bin/docker-compose ]]"
13-
check "installs compose-switch" bash -c "[[ -f /usr/local/bin/compose-switch ]]"
13+
14+
check "Not installing compose-switch by default" bash -c "[[ ! -f /usr/local/bin/compose-switch ]]"
1415

1516
# Report result
1617
reportResults

test/docker-in-docker/docker_specific_moby_buildx.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ check "docker-buildx" docker buildx version
1414
check "docker-build" docker build ./
1515

1616
check "installs docker-compose v1 install" bash -c "type docker-compose"
17-
check "installs compose-switch" bash -c "[[ -f /usr/local/bin/compose-switch ]]"
17+
18+
check "Not installing compose-switch by default" bash -c "[[ ! -f /usr/local/bin/compose-switch ]]"
1819

1920
# Report result
2021
reportResults

test/docker-in-docker/scenarios.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@
5555
},
5656
"remoteUser": "node"
5757
},
58+
"docker_build_with_compose_switch": {
59+
"image": "mcr.microsoft.com/devcontainers/javascript-node:0-18",
60+
"features": {
61+
"docker-in-docker": {
62+
"version": "latest",
63+
"moby": "false",
64+
"dockerDashComposeVersion": "v2",
65+
"installDockerComposeSwitch": true
66+
}
67+
},
68+
"remoteUser": "node"
69+
},
5870
"docker_build_2": {
5971
"image": "ubuntu:noble",
6072
"features": {

0 commit comments

Comments
 (0)