DockerCompose the network settings

By default, each vessel is launched in docker each have their own separate network, thus isolated from one another between the individual containers, but if you want to make the network capable of communicating between the container, you can start the script container (DockerCompose) set in the plus segment of a network.

Note: dockercompose start in a container having the same network, that is, they can be in the same local area network.

First, this figure can be seen that each container starts, will create its own network

 

 Second, an increase in network disposed dockercompose, the container compose different files in the same LAN

 

 

 

 Third, when setting up this common network, compose the container can communicate in the same local area network with each other, but they also differ accessed in the public network or an external network by way of ip and port, but by the service name ame way to access, such as a service name following figure is mysql db container, so you can access the container in the code by db

 

Guess you like

Origin www.cnblogs.com/hopeiscoming/p/12337589.html