Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 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": "4.1.3",
"version": "4.1.4",
"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 Down
2 changes: 1 addition & 1 deletion src/docker-in-docker/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ if [ "${IPTABLES_SWITCH_AT_RUNTIME}" = "true" ] && [ "${ADJUSTED_ID}" = "debian"
# and would defeat hosts/scenarios where the module is intentionally absent
# such as the newer kernels which leaves out ip_tables legacy.)
if type iptables-legacy > /dev/null 2>&1 \
&& { grep -qE '^(ip_tables)\b' /proc/modules \
&& { grep -qE '^(ip_tables)\b' /proc/modules 2>/dev/null \
|| [ -d /sys/module/ip_tables ]; } \
&& update-alternatives --list iptables 2>/dev/null | grep -q '/usr/sbin/iptables-legacy'; then
sudo_if update-alternatives --set iptables /usr/sbin/iptables-legacy || true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ check "init-script-exists" bash -c "test -f /usr/local/share/docker-init.sh"
check "runtime-iptables-block-present" bash -c "grep -q 'update-alternatives --set iptables' /usr/local/share/docker-init.sh"
check "runtime-iptables-block-has-legacy-branch" bash -c "grep -q '/usr/sbin/iptables-legacy' /usr/local/share/docker-init.sh"
check "runtime-iptables-block-has-nft-branch" bash -c "grep -q '/usr/sbin/iptables-nft' /usr/local/share/docker-init.sh"
check "runtime-iptables-proc-modules-check-is-quiet" bash -c "grep -q '/proc/modules 2>/dev/null' /usr/local/share/docker-init.sh"

# The runtime block runs as part of docker-init.sh (the feature's entrypoint),
# so by the time these tests execute the alternative must already be set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ set -e
source dev-container-features-test-lib

check "entrypoint runs as codespace" bash -c "test \"$(id -un)\" = codespace"
check "iptables uses legacy backend" bash -c "iptables --version | grep -q '(legacy)'"
check "iptables version" iptables --version
# The build-time switch should have set /etc/alternatives/iptables to one of the
# known backends. With the ip_tables module loaded on the host, legacy is preferred.
check "iptables-alternative-set" bash -c "readlink /etc/alternatives/iptables | grep -E 'iptables-(legacy|nft)$'"
check "iptables works" sudo iptables -L

# Report result
reportResults