How can I give two Docker containers separate IPs on Windows?

November 12, 2026 3 answers
Asked by beyond_the_checkout

I need two containers to communicate with each other and with the Windows host, using separate IPs. I'm using Docker Desktop with Hyper-V and can't use WSL. Is a bridge network enough, or do I need extra loopback adapters?

Answers

BOLDER THAN BINDER

Start with a user-defined bridge network. Each container gets its own address on that network, and the containers can reach each other there. They can also use container names for discovery, so you may not need to hard-code their IPs.

The catch is the Windows host. With Docker Desktop, Linux containers run behind a VM, so those bridge addresses aren't necessarily directly reachable from Windows like they would be from a Linux host. Publish the ports Windows needs to access, and use host.docker.internal for connections from a container back to a service on the host.

RUMBLE IN THE HALL:

Also check that the host service is listening on an address reachable from the containers and that the Windows firewall permits the connection.

Reply to this answer
_forecast_requires_socks

The key question is whether you need separate IPs inside Docker or separate IPs that Windows can connect to directly. Those are different requirements on Docker Desktop. If published ports on the host are enough, you probably don't need loopback adapters. If each container must have a distinct host-reachable IP, that needs a different setup.

Reply to this answer
almost.a.duet

Another option is a lightweight Linux VM under Hyper-V with Docker installed inside it. That gives you a more familiar Linux bridge setup to work with. You would still need to arrange routing or port forwarding if Windows needs to reach the containers' bridge IPs directly.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions