[Docker] Getting Started with Container Networks

It is possible to group containers into a network and we can create multi networks so that container in each isolated network can communiate with each other, but we can fine control the access right by using network, how containers communiate should happen inside network.

In this post, we are going to see how to create a network and how to run a container inside a network.

Create a network:

docker network create --driver bridge isolated_network

Run containers in the Container Network

docker run -d --net=isolated_network --name mongodb mongo

Give every container you want to link into the network a name.
 
in next post, we will see how to do it in a real world example
原文地址:https://www.cnblogs.com/Answer1215/p/10656041.html