Docker Network
Contents
Docker Network Mode
Mode | Command | Description |
---|---|---|
NONE | docker run --network none nginx | The container is isolated. |
HOST | docker run --network host nginx | The container uses host network. |
BRIDGE | docker run nginx | The container uses bridge network that. |
NONE
NONE
The containers are being isolated. So they can’t connect out of the container.
|
|

HOST
HOST
The containers are running on host network, so the containers are using same ports between host and containers.
Below example, the first container is running, but second container is fail to running because it tries to use a port 80 that is used in first container.
The
You can connect to
Below example, the first container is running, but second container is fail to running because it tries to use a port 80 that is used in first container.
The
nginx
is using a port 80 as a default.You can connect to
http://192.168.1.10:80
|
|

BRIDGE
BRIDGE
The
And each container has they own network.
That means each container can use a 80 port.
You can connect below links in local network.
docker
make a BRIDGE
for the docker
network.And each container has they own network.
That means each container can use a 80 port.
You can connect below links in local network.
http://172.17.0.2:80
http://172.17.0.3:80
|
|

How to Work Docker Bridge?
Docker Bridge Network
In this section, we will discover the docker bridge network process.
You can more detail my past network posts
You can more detail my past network posts
Create a Bridge in Docker Network NS bridge
Check Docker Namespace List
|
|
|
|
Crate Bridge
|
|
Check Link
|
|
|
|

Assign IP to the Bridge
|
|
|
|
|
|

Create a Container and Network Namespace

Check Network Namespace
|
|
|
|
Create a vEth(Virtual Ethernet) Pairs(Pipe, Virtual Cabe)
|
|

Attach vEth to the Bridge
|
|

Attach vEth to the Container Namespace
|
|

Assign IP to the Container vEth
|
|
|
|
|
|

Bring the Bridge Up
|
|

Enable NAT
In Local
|
|
Out of Local
Use Bridge Network
|
|
Use Host Network
|
|
Docker Port Forward
|
|
|
|
Manually Port Forward
|
|
Check Port Forward List
|
|
|
|