From 9547928f308de63df56e600ef2bb2fd7ff65808c Mon Sep 17 00:00:00 2001 From: bilby91 <2201079+bilby91@users.noreply.github.com> Date: Wed, 4 Nov 2026 15:36:50 +0000 Subject: [PATCH 1/2] test(integration): report inner dockerd logs when docker-in-docker fails to start Both docker-in-docker tests waited for the inner dockerd and, on timeout, reported only that its socket was absent. The feature's docker-init.sh logs dockerd and containerd to /tmp; include their tail, the kernel and the selected iptables alternative in the failure. The first test's inline copy of the wait loop now uses waitInnerDockerd. Co-Authored-By: Claude Opus 5.5 --- test/integration/compose_dind_test.go | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/test/integration/compose_dind_test.go b/test/integration/compose_dind_test.go index e185d68..5684f08 100644 --- a/test/integration/compose_dind_test.go +++ b/test/integration/compose_dind_test.go @@ -112,20 +112,7 @@ services: // dockerd is started in the background by the feature's // entrypoint; wait for it, then run a container. - deadline := time.Now().Add(2 * time.Minute) - for { - res, err := eng.Exec(ctx, wsObj, devcontainer.ExecOptions{ - Cmd: []string{"docker", "info", "--format", "{{.Driver}}"}, - }) - if err == nil && res.ExitCode == 0 { - t.Logf("inner dockerd storage driver: %s", strings.TrimSpace(res.Stdout)) - break - } - if time.Now().After(deadline) { - t.Fatalf("inner dockerd never became ready: err=%v res=%+v", err, res) - } - time.Sleep(2 * time.Second) - } + waitInnerDockerd(t, ctx, eng, wsObj) res, err := eng.Exec(ctx, wsObj, devcontainer.ExecOptions{ Cmd: []string{"docker", "run", "--rm", "hello-world"}, @@ -150,10 +137,18 @@ func waitInnerDockerd(t *testing.T, ctx context.Context, eng *devcontainer.Engin Cmd: []string{"docker", "info", "--format", "{{.Driver}}"}, }) if err == nil && res.ExitCode == 0 { + t.Logf("inner dockerd storage driver: %s", strings.TrimSpace(res.Stdout)) return } if time.Now().After(deadline) { - t.Fatalf("inner dockerd never became ready: err=%v res=%+v", err, res) + // The feature's docker-init.sh starts dockerd (and + // containerd) in the background with their output in /tmp; + // without it a failure says only that the socket is absent. + diag, _ := eng.Exec(ctx, ws, devcontainer.ExecOptions{Cmd: []string{"sh", "-c", + "uname -r; update-alternatives --query iptables | grep '^Value'; " + + "echo '--- dockerd.log'; tail -n 40 /tmp/dockerd.log; " + + "echo '--- containerd.log'; tail -n 20 /tmp/containerd.log"}}) + t.Fatalf("inner dockerd never became ready: err=%v res=%+v\n%s%s", err, res, diag.Stdout, diag.Stderr) } time.Sleep(2 * time.Second) } From fe7d636dd1e1ef8b136bf3eb66f2cf508419f17e Mon Sep 17 00:00:00 2001 From: bilby91 <2201079+bilby91@users.noreply.github.com> Date: Wed, 4 Nov 2026 15:48:01 +0000 Subject: [PATCH 2/2] test(integration): run docker-in-docker tests on feature v4 ubuntu-latest moved to ubuntu-26.04 (kernel 7.0) and both docker-in-docker tests began failing on every runner, main included. The inner dockerd log, now reported, shows why: docker-in-docker:2 (2.17.0) switches a Debian image to iptables-legacy unconditionally at install time, and on a kernel without legacy iptables dockerd exits with "failed to create NAT chain DOCKER: iptables v1.8.9 (legacy)". v4 checks at install time and re-selects at container start, choosing nft there. Move dindFeatureRef to :4. v4 declares a second volume (/var/lib/containerd); the first test now cleans up with cleanupComposeWorkspace, which removes every project volume, instead of only the /var/lib/docker one. Pinning the runner to ubuntu-24.04 was not taken: it hides the incompatibility until that image retires. Co-Authored-By: Claude Opus 5.5 --- test/integration/compose_dind_test.go | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/test/integration/compose_dind_test.go b/test/integration/compose_dind_test.go index 5684f08..d031882 100644 --- a/test/integration/compose_dind_test.go +++ b/test/integration/compose_dind_test.go @@ -17,8 +17,15 @@ import ( // dindFeatureRef is the upstream docker-in-docker feature. Its metadata // declares the mount this test is about — // {"source":"dind-var-lib-docker-${devcontainerId}","target":"/var/lib/docker","type":"volume"} -// — alongside privileged and the docker-init.sh entrypoint. -const dindFeatureRef = "ghcr.io/devcontainers/features/docker-in-docker:2" +// — alongside privileged and the docker-init.sh entrypoint (and, since +// v4, a second volume at /var/lib/containerd). +// +// Major version 4 or later: v2 switches a Debian image to +// iptables-legacy unconditionally at install time, and the inner +// dockerd then cannot create its NAT chain on hosts whose kernel no +// longer supports legacy iptables (Ubuntu 26.04, the ubuntu-latest +// runner since 2026-11). v4 chooses nft there. +const dindFeatureRef = "ghcr.io/devcontainers/features/docker-in-docker:4" // dindBaseImage is a Debian base the feature's install script supports. const dindBaseImage = "debian:bookworm-slim" @@ -82,17 +89,7 @@ services: out, lsErr := exec.Command("docker", "volume", "ls", "-q", "--filter", "label=com.docker.compose.volume="+volKey).Output() vols := strings.Fields(string(out)) - t.Cleanup(func() { - _ = eng.Down(context.Background(), wsObj, devcontainer.DownOptions{ - Remove: true, - RemoveVolumes: true, - }) - // Down does not remove every named volume on every - // backend; remove the feature's volume explicitly. - for _, v := range vols { - _ = exec.Command("docker", "volume", "rm", "-f", v).Run() - } - }) + cleanupComposeWorkspace(t, eng, wsObj) if lsErr != nil || len(vols) != 1 || !strings.HasSuffix(vols[0], "_"+volKey) { t.Fatalf("project volume for %s = %v (err %v), want exactly one _%s", volKey, vols, lsErr, volKey) }