How does `--network host` work and what are the trade-offs?

IntermediateConceptNetworking
Answer

The container shares the host's network namespace: no veth, no NAT, no port mapping (-p is ignored). Lowest latency and handy for performance or tools needing host interfaces. Costs: port conflicts, no network isolation, and on Docker Desktop it applies to the VM (recent versions added opt-in host networking support). Not usable with Compose service name DNS across networks.

All Docker questions Roadmap: Docker & containers

More on Networking