chipmk / docker-mac-net-connect

Connect directly to Docker-for-Mac containers via IP address 🐳 💻
MIT License
402 stars 41 forks source link

chore: support connecting to docker desktop containers on windows #37

Open bliles opened 4 weeks ago

bliles commented 4 weeks ago

It's possible that a change like this would be better off as a fork or even a separate repo, which I'm willing to do, but I wanted to see first if you would be interested in upstreaming the work. It could mean that the project would become something like Docker Desktop Net Connect.

I've tested the Windows support and the biggest limitation is that the user needs to start the executable as a privileged service (I've just been using psexec for testing). Simply launching the executable from an elevated shell is insufficient for starting the tunnel.

gregnr commented 4 weeks ago

Hey @bliles, great work! Definitely open to upstreaming this 🚀

Edit: looks like the Docker Windows docs have been updated to be more clear - direct IP addressing is only available on Windows containers. So definitely will need WireGuard here!

Give me a bit of time to review this PR 👍


Original:

Just so that I'm clear, can you confirm that Windows does not expose any kind of bridge network already for containers? We've briefly looked at supporting Windows in the past but decided against it at the time because the Docker docs seemed to mention a bridge network already existing: #9

Tbh, even if a bridge network does already exist on Windows, we still need to update the routing table so worth adding that at a minimum (or the full WireGuard tunnel to be consistent)

bliles commented 4 weeks ago

Thanks so much for taking a look at my work, feedback appreciated!

Windows does have a bridge network for the containers, but this network is limited to the docker VM: https://docs.docker.com/desktop/networking/#i-cannot-ping-my-containers. The docs further state that the bridge network is not reachable from the host (unless you are using Windows containers).

The solution generally mentioned for Docker on Windows is the same as Mac, mapping ports from the host to the container.