By default when Docker is installed, it creates a software bridge interface on the host called docker0.
The "docker0" bridge interface gets a private IP address, usually 172.17.42.1.
When the containers are started they get an address in the range 172.17.42.0/24.

The container's interface:

The container's network int
erface connects to the bridge (docker_0) so it can use it as a gateway to connect to the host's network interface.
After the container starts running, it creates a pair of network interfaces.


One end of the interface lives in the network namespace of the container (eth0) and the other lives in the networking namespace of the host (veth_bridge) and is attached to the bridge docker0.

To see the interfaces we use the below command:


We can run the container (Debian in our case):


We find ourselves inside the container then we run:


The vethxxx interfaces are created on the host and are attached to the bridge docker0.

Bridge interfaces:


Displays all the bridge interfaces on the host.

NAT and Port Forwarding:

NAT (Network Address Translation)
The interface on the host uses NAT. To display these rules, we use:



It maps the private address to the public address, by replacing the private address with the public address on outgoing queries, and it does the opposite when the response arrives.

Port Forwarding: Port Forwarding maps a port and an IP address to another port and IP address.


To enable Port forwarding, we use:



Brando Sabatini and Ikbal C ©. Powered by Blogger.