[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.

[Docker] Getting Started with Container Networks_第1张图片

 

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

[Docker] Getting Started with Container Networks_第2张图片

 

Run containers in the Container Network

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

[Docker] Getting Started with Container Networks_第3张图片

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

你可能感兴趣的:([Docker] Getting Started with Container Networks)