Skip to content

Namespaces: what a container can see

Select an icon to see what it is.

Step 5 of 6

net: its own network stack

The network namespace holds its own interfaces, routes and iptables rules. Docker puts one end of a veth pair inside as eth0 with 172.18.0.2. The namespace file lives under /var/run/docker/netns on the host.

$ docker run --rm --network container:web alpine ip addr

Interfaces seen by the container

lo
eth0 172.18.0.2/16 gateway 172.18.0.1
/var/run/docker/netns/<id> (handle on the host)