Docker Networking

By default, uses a type of network called bridge network. Within a given Docker Host, all the containers can easily communicate with each other.

Their usual IP addresses start off with 172.17.xxx.xxx

Port mapping is essential in case of a web application listening in on a port. This is because bridge network provides an internal port. To view an web application, one needs to map the container to a port that is accessible by the web browsers.

The second type of network is called the host network. This is where the docker container’s ports are directly mapped to host computer’s or server’s port. In this case, port mapping is not required.

The third type of network is called none. This basically means isolated network.

There is a way to configure a custom network, where within the same docker host there could be two or more different subnets. This may look like,

Docker network create \
—drier bridge \
—subnet 198.xxx.xxx.xxx/24 \
—gateway 198.xxx.xxx.xxx \

Leave a comment