Networking from host to container is not working

I just got a new desktop computer, and tried putting a development project on it. It is a web app, so I have a container for Apache, a container for Tomcat, and a container for MySQL.

The apache container exposes ports 80 and 443 to the host. On this new desktop computer, Chrome takes a very long time to access pages on this app (upwards of 15 seconds), and frequently gets ERR_NETWORK_CHANGED errors. Reloading the page sometimes will work, sometimes I just have to go back to the login url.

Note that this app works absolutely perfectly fine on my laptop exactly the same branch, same commit, same build tool. Perfectly fine.

I don’t know whether this is a Docker issue or a Windows 11 (host) issue. Chrome devtools just says “(failed) net::ERR_NETWORK_CHANGED” I note that for pages that actually do load (or start to load) scripts and css files all take over 5s to load.

Most websites out on the internet, I can access just fine. Docker container? Nope.

Any ideas would be useful.

This could be related to a vpn connection being established after the browser was opened. Especially if a brittle vpn connection would result in re-establishing the connection over and over again.

If Windows host folders are bound to container folders, performance degradation is to be expected due to how WSL2 mounts Windows folders into the Linux distribution.

Users with a Docker Desktop Pro or Team subscription can enable and use Syncronized File Sharing.

Users without those subscriptions can work around the performance degradation, by storing the files in a wsl distribution, enable wsl integration in Docker Desktop for this specific distribution, and execute the docker commands from within that distribution.

Hi Metin,

I found the problem, the new computer had a hardware problem – performance degraded badly, then I looked in Task Manager and it said I had half the ram I paid for… Opened the case and one ram module fell out when I touched it, the other was loose. So I reseated them correctly, had to do a reset-my-pc because a bunch of stuff was corrupted.

After I reinstalled the world, my app and dev env are all working absolutely wonderfully, including Docker and networking.

Your comment about bind mounts and doing a wsl integration is very interesting!

I have the git repo in the host Windows, and a builder container. The entrypoint.sh in that container copies the source from the host into a directory inside and runs a Maven build., then shoves the war files out another bind mount.

There’s about 300Mb of source, and this takes randomly anywhere from 8s to 200s to do the copy. The build takes 20-30s. I’ll look into that.

Thanks very much!
Iain

2 Likes