Skip to content

Network modes: bridge, none and host

Select an icon to see what it is.

Step 6 of 6

Choosing a mode

Bridge isolates the container and lets you publish chosen ports. Host is the fastest and simplest, but gives up isolation and port control. None is for work that needs no network at all.

PrevNext

Summary

bridge: own namespace, own IP, -p works
none: own namespace, loopback only
host: host's namespace, -p ignored

Try it yourself

Compare ip addr in the three modes. The host-mode nginx needs port 80 to be free on the host.

$ docker run --rm alpine ip addr
$ docker run --rm --network none alpine ip addr
$ docker run --rm --network host alpine ip addr
$ docker run -d --name hostweb --network host nginx
$ ss -ltn 'sport = :80'
$ docker rm -f hostweb

Quiz

1. What does a container with --network none have?
2. Why is -p ignored with --network host?
3. What is the main cost of host mode?