Host Networking

Host Networking and When to Use It

--network host skips the network namespace entirely: the container uses the host's interfaces, addresses and ports directly. There is no bridge, no NAT and no port publishing, and a server in the container listens on the host's own ports:

A container sharing the host's network stackShell
docker run --rm --network host alpine:3 ip addr show eth0 | grep 'inet '
docker run -d --name l3-hostweb --network host node:24-slim \
  node -e "require('http').createServer((q, r) => r.end('hi\n')).listen(33080)"
sleep 1
curl -s localhost:33080
sudo ss -ltnp | grep 33080 | cut -c 1-90
docker rm -f l3-hostweb
docker run --rm --network host nginx:stable 2>&1 | grep -m1 emerg
Output
    inet 172.23.167.60/20 brd 172.23.175.255 scope global eth0
daf7897731bee109d51a4dd9e0b7ba4cd2cdc332644fafa4cf56e5926db1c9f4
hi
LISTEN 0      511                 *:33080            *:*    users:(("MainThread",pid=40581
l3-hostweb
2026/09/25 08:53:41 [emerg] 1#1: bind() to 0.0.0.0:80 failed (98: Address already in use)

The container saw the WSL 6 virtual machine's own eth0 address, and ss shows Node.js 2,131 on the host's port 33080 with no docker-proxy. The last command shows the price: nginx 75 wants port 80, which an Apache server on this host already holds, so the container fails. Any -p flag is discarded with a warning.

Use host networking for monitoring agents such as the Prometheus 16,091 node exporter, tools that must see every interface, and services with huge port ranges. On Linux it works as shown; Docker Desktop 514 supports it from version 4.34 only after you enable it in Settings, because there the "host" is Desktop's virtual machine, not your computer.