Skip to content
Draft
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
20 changes: 20 additions & 0 deletions test/docker-in-docker/docker_with_iptables.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

# Feature specific tests
check "iptables works" sudo iptables -L
check "iptables uses legacy" bash -c "iptables --version | grep legacy"

check "version" docker --version
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'"

# Report result
reportResults

20 changes: 20 additions & 0 deletions test/docker-in-docker/docker_with_iptables_ubuntu.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

# Feature specific tests
check "iptables works" sudo iptables -L
check "iptables uses legacy" bash -c "iptables --version | grep legacy"

check "version" docker --version
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'"

# Report result
reportResults

34 changes: 34 additions & 0 deletions test/docker-in-docker/docker_without_iptables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Feature specific tests
check "docker-ps" bash -c "docker ps"
# Fail loudly if dockerd never finished initializing, printing the real error
check "dockerd-started-successfully" bash -c '
if ! grep -q "Daemon has completed initialization" /tmp/dockerd.log; then
echo "❌ Docker daemon failed to start. Last errors from /tmp/dockerd.log:"
echo "----- dockerd.log (tail) -----"
tail -n 100 /tmp/dockerd.log
echo "----- error/fatal lines -----"
grep -iE "error|fatal|failed|panic" /tmp/dockerd.log || true
exit 1
fi
'
check "log-for-completion" bash -c "cat /tmp/dockerd.log | grep 'Daemon has completed initialization'"

check "iptables works" sudo iptables -L
check "iptables uses nf_tables" bash -c "iptables --version | grep nf_tables"

check "version" docker --version
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'"

# Report result
reportResults

20 changes: 20 additions & 0 deletions test/docker-in-docker/docker_without_iptables_ubuntu.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

# Feature specific tests
check "iptables works" sudo iptables -L
check "iptables uses nf_tables" bash -c "iptables --version | grep nf_tables"

check "version" docker --version
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'"

# Report result
reportResults

36 changes: 36 additions & 0 deletions test/docker-in-docker/scenarios.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
{
"docker_without_iptables": {
"image": "mcr.microsoft.com/devcontainers/base:debian",
"features": {
"docker-in-docker": {
"moby": "false"
}
},
"initializeCommand": "sudo modprobe --remove --remove-holders --wait 1000 ip_tables"
},
"docker_with_iptables": {
"image": "mcr.microsoft.com/devcontainers/base:debian",
"features": {
"docker-in-docker": {
"moby": "false"
}
},
"initializeCommand": "sudo modprobe ip_tables"
},
"docker_without_iptables_ubuntu": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"docker-in-docker": {
"moby": "false"
}
},
"initializeCommand": "sudo modprobe --remove --remove-holders --wait 1000 ip_tables"
},
"docker_with_iptables_ubuntu": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"docker-in-docker": {
"moby": "false"
}
},
"initializeCommand": "sudo modprobe ip_tables"
},
"overlayfs_containerd_root": {
"image": "mcr.microsoft.com/devcontainers/base:noble",
"features": {
Expand Down
Loading