Skip to content

test: let dockerd choose its bridge subnet in the WSL smoke distribution - #346615

Merged
Bryan Chen (bryanchen-d) merged 1 commit into
mainfrom
copilot/vscode/wsl-prepared-docker-network
Nov 6, 2026
Merged

Bryan Chen (bryanchen-d) merged 1 commit into
mainfrom
copilot/vscode/wsl-prepared-docker-network

Conversation

@bryanchen-d

@bryanchen-d Bryan Chen (bryanchen-d) commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes WSL-PREPARED-DNS: since #346338 started importing a prepared WSL distribution, Windows / Electron-Smoke (shard 1/3) intermittently fails Agents Window (WSL Dev Container AgentHost) › Starts and reopens a Dev Container session over WSL. The dev container's postCreateCommand gets curl: (6) Could not resolve host: update.code.visualstudio.com. The latest hit was 17:51 UTC on Nov 6, on #346611.

Cause: dockerd stores the subnet of its default bridge under /var/lib/docker/network and reuses it on every start. The prepared distribution carries the subnet that dockerd picked on the machine that prepared it, 172.17.0.0/16. WSL picks its NAT network per machine, and in the failing runs it was inside that range: the host was 172.17.16.1 or 172.17.112.1, while passing runs were on 172.18, 172.22, 172.26 and 172.31. With overlapping subnets, containers route the resolver and the host into docker0. When dockerd creates the bridge fresh, which is what the built path does, it skips subnets that overlap existing routes. That's why the built path never failed: 30 of 30 runs passed, against 5 of 26 failing on the prepared path.

Fix:

  • Start-SmokeDocker removes /var/lib/docker/network before starting dockerd, so dockerd picks a non-overlapping subnet on every machine. Images, including the pre-pulled dev container image, are kept.
  • The docker.log that the cleanup already uploads now also records the bridge subnet and the distribution's routes, so a future overlap is visible without guessing. Output streamed from wsl.exe doesn't reach the job log, which is why this goes in docker.log.
  • Changing wslDevContainer.ps1 changes the prepared-distribution cache key. After this merges, the shard builds the distribution until the next daily Prepare, and that run uses this script too.

Validation: a temporary commit, now dropped, pinned the cache key to main's current (faulty) prepared distribution. With it, 3 shard runs imported that distribution and passed the WSL Dev Container test (run 42266849943, attempts 2 to 4). The bridge network ID differs on every import (for example a163e56a7d72 and 50785e90b6aa), which confirms the stored network was reset rather than reused. Those agents had WSL networks at 172.24 and 172.28, so they didn't hit the overlap itself. The fix for the overlapping case rests on the mechanism above and on the built path, which already creates the bridge fresh and passed 30 of 30.

lszomoru, this follows up on my comment on #346338. Close it if you'd rather fix it another way.

Authored with Copilot

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Base: 23b07a58 Current: 42ce2f26

No screenshot changes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Pending Windows/WSL proof runs leave Docker’s non-overlapping subnet selection and Dev Container DNS/session startup unverified after VHD import.

No open issues 🎉

What changed in this PR

Updates the WSL smoke-test setup so imported prepared distributions can select a Docker bridge subnet that avoids the current machine’s WSL network, addressing intermittent container DNS failures.

Changes:

  • Removes persisted Docker network state before starting dockerd, while preserving cached images.
  • Logs the Docker bridge and WSL network subnets for diagnosis.
  • Temporarily pins the Windows shard’s cache key to exercise the existing prepared-distribution import path; the PR description marks this proof-only change for removal before leaving draft.
File Description
test/​smoke/​wslDevContainer.ps1 Resets Docker network state before startup and logs both network subnets.
.github/​workflows/​pr-win32-test.yml Temporarily pins the prepared-distribution cache key for validation.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Validation did not cover an overlapping WSL NAT subnet, so confirming that dockerd selects a non-overlapping bridge still requires Windows/WSL runtime testing.

No open issues 🎉

Review effort: Balanced

dockerd stores the subnet of its default bridge under /var/lib/docker/network.
The prepared WSL distribution (#346338) brings the subnet chosen on the
machine that prepared it, 172.17.0.0/16, and when WSL puts this machine's NAT
network inside it (172.17.16.0/20, 172.17.112.0/20), containers cannot reach
the resolver: the dev container's postCreateCommand fails with 'Could not
resolve host' and the WSL Dev Container smoke test times out. Remove the
stored network before starting dockerd, so it picks a subnet that does not
overlap this machine's routes, and log both subnets.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the Docker network reset and expanded WSL smoke-test diagnostics.

No open issues 🎉

Review effort: Balanced

@bryanchen-d
Bryan Chen (bryanchen-d) marked this pull request as ready for review November 6, 2026 23:40
@bryanchen-d
Bryan Chen (bryanchen-d) enabled auto-merge (squash) November 6, 2026 23:40
@bryanchen-d
Bryan Chen (bryanchen-d) merged commit c8aa95c into main Nov 6, 2026
53 checks passed
@bryanchen-d
Bryan Chen (bryanchen-d) deleted the copilot/vscode/wsl-prepared-docker-network branch November 6, 2026 23:53
@vs-code-engineering vs-code-engineering Bot added this to the 1.146.0 milestone Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants