Skip to content

Commit

Permalink
Docker: Unpin "mobyBuildxVersion" (#877)
Browse files Browse the repository at this point in the history
  • Loading branch information
samruddhikhandale authored Feb 26, 2024
1 parent 758b032 commit a8dc2db
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/docker-in-docker/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "docker-in-docker",
"version": "2.9.1",
"version": "2.9.2",
"name": "Docker (Docker-in-Docker)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-in-docker",
"description": "Create child containers *inside* a container, independent from the host's docker instance. Installs Docker extension in the container along with needed CLIs.",
Expand All @@ -22,8 +22,8 @@
},
"mobyBuildxVersion": {
"type": "string",
"default": "0.12.0",
"description": "Install a specific version of moby-buildx when using Moby. (2024-02-09: Microsoft's Package Manifest has mismatching filesize and SHA for 0.12.1; default is last known good version)"
"default": "latest",
"description": "Install a specific version of moby-buildx when using Moby"
},
"dockerDashComposeVersion": {
"type": "string",
Expand Down
14 changes: 8 additions & 6 deletions src/docker-in-docker/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

DOCKER_VERSION="${VERSION:-"latest"}" # The Docker/Moby Engine + CLI should match in version
USE_MOBY="${MOBY:-"true"}"
MOBY_BUILDX_VERSION="${MOBYBUILDXVERSION:-"0.12.0"}"
MOBY_BUILDX_VERSION="${MOBYBUILDXVERSION:-"latest"}"
DOCKER_DASH_COMPOSE_VERSION="${DOCKERDASHCOMPOSEVERSION:-"v1"}" # v1 or v2 or none
AZURE_DNS_AUTO_DETECTION="${AZUREDNSAUTODETECTION:-"true"}"
DOCKER_DEFAULT_ADDRESS_POOL="${DOCKERDEFAULTADDRESSPOOL:-""}"
Expand Down Expand Up @@ -228,11 +228,13 @@ else
# Install engine
set +e # Handle error gracefully
apt-get -y install --no-install-recommends moby-cli${cli_version_suffix} moby-buildx${buildx_version_suffix} moby-engine${engine_version_suffix}
if [ $? -ne 0 ]; then
err "Packages for moby not available in OS ${ID} ${VERSION_CODENAME} (${architecture}). To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS version (eg: 'ubuntu-20.04')."
exit 1
fi
set -e
exit_code=$?
set -e

if [ ${exit_code} -ne 0 ]; then
err "Packages for moby not available in OS ${ID} ${VERSION_CODENAME} (${architecture}). To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS version (eg: 'ubuntu-20.04')."
exit 1
fi

# Install compose
apt-get -y install --no-install-recommends moby-compose || err "Package moby-compose (Docker Compose v2) not available for OS ${ID} ${VERSION_CODENAME} (${architecture}). Skipping."
Expand Down
6 changes: 3 additions & 3 deletions src/docker-outside-of-docker/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "docker-outside-of-docker",
"version": "1.4.1",
"version": "1.4.2",
"name": "Docker (docker-outside-of-docker)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-outside-of-docker",
"description": "Re-use the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands.",
Expand All @@ -22,8 +22,8 @@
},
"mobyBuildxVersion": {
"type": "string",
"default": "0.12.0",
"description": "Install a specific version of moby-buildx when using Moby. (2024-02-09: Microsoft's Package Manifest has mismatching filesize and SHA for 0.12.1; default is last known good version)"
"default": "latest",
"description": "Install a specific version of moby-buildx when using Moby"
},
"dockerDashComposeVersion": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion src/docker-outside-of-docker/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

DOCKER_VERSION="${VERSION:-"latest"}"
USE_MOBY="${MOBY:-"true"}"
MOBY_BUILDX_VERSION="${MOBYBUILDXVERSION:-"0.12.0"}"
MOBY_BUILDX_VERSION="${MOBYBUILDXVERSION:-"latest"}"
DOCKER_DASH_COMPOSE_VERSION="${DOCKERDASHCOMPOSEVERSION:-"v1"}" # v1 or v2 or none

ENABLE_NONROOT_DOCKER="${ENABLE_NONROOT_DOCKER:-"true"}"
Expand Down
20 changes: 20 additions & 0 deletions test/docker-in-docker/docker_specific_moby_buildx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib
# Definition specific tests
check "moby-buildx" bash -c "dpkg-query -W moby-buildx | grep -E '0.12.0'"

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

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 ]]"

# Report result
reportResults
8 changes: 8 additions & 0 deletions test/docker-in-docker/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@
}
}
},
"docker_specific_moby_buildx": {
"image": "ubuntu:focal",
"features": {
"docker-in-docker": {
"mobyBuildxVersion": "0.12.0"
}
}
},
// DO NOT REMOVE: This scenario is used by the docker-in-docker-stress-test workflow
"docker_with_on_create_command": {
"image": "mcr.microsoft.com/devcontainers/base:debian",
Expand Down
1 change: 1 addition & 0 deletions test/docker-in-docker/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ check "docker-ps" bash -c "docker ps"
check "log-exists" bash -c "ls /tmp/dockerd.log"
check "log-for-completion" bash -c "cat /tmp/dockerd.log | grep 'Daemon has completed initialization'"
check "log-contents" bash -c "cat /tmp/dockerd.log | grep 'API listen on /var/run/docker.sock'"
check "moby-buildx" bash -c "dpkg-query -W moby-buildx"

# Report result
reportResults
19 changes: 19 additions & 0 deletions test/docker-outside-of-docker/docker_specific_moby_buildx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib
# Definition specific tests
check "moby-buildx" bash -c "dpkg-query -W moby-buildx | grep -E '0.12.0'"

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

check "docker-buildx" docker buildx version
check "docker-build" docker build ./

check "installs docker-compose v1 install" bash -c "type docker-compose"

# Report result
reportResults
8 changes: 8 additions & 0 deletions test/docker-outside-of-docker/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,13 @@
}
},
"remoteUser": "node"
},
"docker_specific_moby_buildx": {
"image": "ubuntu:focal",
"features": {
"docker-outside-of-docker": {
"mobyBuildxVersion": "0.12.0"
}
}
}
}
1 change: 1 addition & 0 deletions test/docker-outside-of-docker/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ check "docker compose" bash -c "docker compose version"
check "docker-compose" bash -c "docker-compose --version"

check "docker-ps" bash -c "docker ps >/dev/null"
check "moby-buildx" bash -c "dpkg-query -W moby-buildx"

# Report result
reportResults

0 comments on commit a8dc2db

Please sign in to comment.