Can't access local network from containers (Docker Desktop Windows WSL2)

I am having problems accessing my local network from all my containers. For example, in Immich, when I try to bind mount to my NAS, I get this error.

(HTTP code 500) server error - error while mounting volume '/var/lib/docker/volumes/immich_network_phone_media/_data': failed to mount local volume: mount //192.168.1.6/Phone_Media:/var/lib/docker/volumes/immich_network_phone_media/_data, data: username=xxxx,password=********,vers=3.0: no route to host

In another example, Portainer can’t connect to my other Portainer Agents or Open WebUI can’t connect to my external Ollama server. This was working a few days ago.

I tried running docker run --rm -it alpine sh and pinging 192.168.1.6 from there, and it doesn’t work.

The system is running Windows 10, with Docker Desktop Version 4.50.0 (209931). Although this issue didn’t start in this version. I updated it to the latest to try to fix it.

I also tried this on another Windows system running Docker Desktop and it has no issues, including running the alpine container to try and ping 192.168.1.6.

Anyone has any ideas why? Or any ideas on how I can troubleshoot this?

Docker networks could have similar subnets. The default is not that, but when there is no more free subnets, 192.168 can be used too. I would check the network in the VM

docker run --rm -it --net host alpine sh ip addr

Docker Desktop v4.50 has a new feature that detects routes on the host before chosing a network for the VM, but that doesn’t help when the problem is caused by Docker networks.

https://docs.docker.com/desktop/release-notes/#4500

Quote:

Docker Desktop now detects and attempts to avoid clashes between the “Docker subnet” and physical networks using RFC1918 addresses. For example if the host has a non-default route which overlaps with 192.168.65.0/24 then an alternative network will be chosen automatically. You can still override the choice as before via Docker Desktop settings and admin settings.

Even if the daemon in Docker Desktop’s VM somehow avoids creating docker networks with colliding IP addresses, when you already had those networks before the upgrade, docker networks would not be regenerated probably.

“HTTP code 500” is also suspicious. That means there is a server returning it. Where did you see that error message?

Are you behind a proxy or firewall?

I tried a Windows machine, but I could not reproduce this error with pings to local IPs.

Hi, after much debugging I found that there was a change in networking behaviour in Docker desktop after an update.

The solution for me was to factory reset docker desktop, and then everything went back to normal:

Docker Desktop → Troubleshoot → Reset to factory defaults

I am using a Mac, but here was the conclusion from my debugging session with ChatGPT:

Your Mac currently has no vmnet interfaces for Docker, and your docker system info shows no vpnkit network.

This explains why:

  • Your containers can reach the Docker host (172.18.0.1)
  • But cannot reach the LAN ( 192.168.1.x**)**

Because on macOS, Docker Desktop normally uses vpnKit / vmnet8 to NAT traffic from containers to the LAN. Without it, the 172.x network is isolated inside the Docker VM and cannot route to your LAN.

Hope that helps!