Skip to content

[WSL 2.9.3] Docker fails to bind ports with "address already in use" when networkingMode=mirrored is enabled #40984

Description

@gsdukbh

Windows Version

Microsoft Windows [version 10.0.26200.8246]

WSL Version

2.9.3.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

Linux version 6.18.35.2-microsoft-standard-WSL2

Distro Version

Ubuntu 22.04

Other Software

  • Docker Desktop or Docker Engine running inside WSL
  • Docker Compose

Repro Steps

  1. Upgrade WSL to version 2.9.3 (pre-release).
  2. Enable mirrored networking by adding the following to %USERPROFILE%\.wslconfig:
    [wsl2]
    networkingMode=mirrored
1 .Restart WSL completely (wsl --shutdown).
2. Attempt to start a Docker container that exposes a port to the host (e.g., 0.0.0.0:8003:8003). I was trying to run Immich via docker-compose up -d.


### Expected Behavior

The Docker container should start successfully, bind to the port, and the service should be accessible via both localhost:8003 and the Windows host's LAN IP address (e.g., http://192.168.1.39:8003/


### Actual Behavior

Docker fails to start the container and throws the following endpoint connectivity error:
> Error response from daemon: failed to set up container networking: driver failed programming external connectivity on endpoint immich_server (...): failed to bind host port 0.0.0.0:8003/tcp: address already in use

Troubleshooting Performed (To rule out user errors)
I have thoroughly checked both the Windows host and the WSL environment to ensure the port is truly available. The issue persists despite confirming the following:

1. No WinNAT Port Reservation: Checked netsh interface ipv4 show excludedportrange protocol=tcp in Windows. Port 8003 is NOT in the excluded range. Restarting WinNAT (net stop winnat / net start winnat) did not help.
2. No Windows Processes Using the Port: Ran netstat -ano | findstr :8003 on Windows. No output.
3. No WSL/Docker Zombie Processes: Ran docker ps -a and sudo ss -tulpn | grep 8003 inside WSL. No leftover containers or docker-proxy processes are holding the port.
4. No PortProxy Conflicts: Verified that there are no conflicting netsh interface portproxy rules active.
5. Successful Downgrade: After safely downgrading WSL from 2.9.3 back to 2.7.10 (and reverting to NAT mode), the network behavior returned to normal, confirming this is a regression or bug specific to the newer pre-release and the mirrored networking mode.


### Diagnostic Logs

_No response_

Metadata

Metadata

Labels

needs-investigationlikely actionable and/or needs more investigationnetworkwsl2Issue/feature applies to WSL 2

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions