Create and manage the virtual networks containers use to talk to each other by name, and understand the built-in network drivers.
| Driver | Use it for |
|---|---|
bridge (default) | Containers on one host. User-defined bridges give automatic DNS by container name |
host | Container shares the host network stack; no -p needed (Linux only) |
none | No networking at all |
overlay | Multi-host networking (Swarm) |
macvlan | Container gets its own MAC/IP on the physical LAN |
bridgelocalhost inside a container means that container, not the host. To reach the host use host.docker.internal (Docker Desktop; on Linux add --add-host=host.docker.internal:host-gateway)-p is only needed for traffic coming from outside Docker; container-to-container traffic uses the internal port