Fix for “Cannot connect to the Docker daemon”

One of the reasons I keep finding my way back to my Linux machine is when I’m doing work using Docker. On Windows, I have a fairly rich (at least I think it is) integration with WSL and Windows and things work great. Except…VS Code and git issues with file properties and WSL randomly can’t connect to the Docker daemon. The first issue may have just been fixed over time by new releases of WSL, I’m still testing that out. But for the second one, I finally found a fix!

I have everything for WSL/Docker integration set up just fine (if you need help with that, check here.) However, for some reason it fails to connect to the daemon with “Cannot connect to the docker daemon at tcp://” message.

Windows can’t connect using that host address, either, so I knew it wasn’t an issue with WSL. My guess was that it was due to a VPN and/or firewall setting, but due to corporate policy on that machine I couldn’t muck with it to test. Now I don’t have to, because I stumbled across this Docker forum post suggesting to run a container that forwards another port, such as 23750, to 2375. Genius, and works like a charm!

Hopefully this helps someone else who’s having a similar issue, even if that someone is me next year when I forget how to fix it. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *