docker-gis+ "Technology and industry solutions

Source: Internet
Author: User


Docker Network

650) this.width=650; "Src=" http://img.blog.csdn.net/20160202172332148?watermark/2/text/ Ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/center "Width=" 803 "height=" 466 "style=" border:none; "/>

The Docker network is typically made up of a veth{id} on the host hosts a virtual NIC and a eth0 one by one mapping inside a container
, we can see that a default Docker0 bridge has been created on the host, the bridge responsible for forwarding the data stream between different veth to realize the IO of the network. Bridge Bridge (DOCKER0) uses the RFC1918 private network, which is responsible for assigning IP to each container.

650) this.width=650; "src=" http://img.blog.csdn.net/20160202172402399 "width=" 803 "height=" 418 "style=" Border:none; " />


Docker's network mode

650) this.width=650; "Src=" http://img.blog.csdn.net/20160202172618734?watermark/2/text/ Ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/center "Width=" 803 "height=" 458 "style=" border:none; "/>

The network mode of Docker consists of four ways:

Understanding the four network patterns can be analogous to the different network settings of the VMware workstation that we often use.

Bridging Mode : Equivalent to the entire host OS, and create a Docker bridge, the entire bridge has a separate IP segment, then the bridge mode of the different container network is the Network Bridge.

As shown below: Docker0 Bridge is 172.17.0.1, then the container instance that starts is 172.17.0.2 ....


[HTML] view plain copy print? 650) this.width=650; "src=" Https://code.csdn.net/assets/CODE_ico.png "width=" "height=" "alt=" on Code view Style= "Border:none;"/>650) this.width=650; "src=" Https://code.csdn.net/assets/ico_fork.svg "width=" 12 "Height=" "alt=" is derived to My code slice "style=" border:none; "/>

  1. [Email protected]:~# ifconfig

  2. Docker0 Link encap:ethernet HWaddr 02:42:17:fb:75:74

  3. inet addr:172.17.0.1 bcast:0.0.0.0 mask:255.255.0.0

  4. Up broadcast multicast mtu:1500 metric:1

  5. RX packets:0 errors:0 dropped:0 overruns:0 frame:0

  6. TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

  7. collisions:0 txqueuelen:0

  8. RX bytes:0  (0.0 B) TX bytes:0 (0.0 B)

  9. Eth0 Link encap:ethernet HWaddr 00:0c:29:8a:ff:d8

  10. inet addr:192.168.12.107 bcast:192.168.12.255 mask:255.255.255.0

  11. Inet6 ADDR:FE80::20C:29FF:FE8A:FFD8/64 Scope:link

  12. Up broadcast RUNNING multicast mtu:1500 metric:1

  13. RX packets:853 errors:0 dropped:0 overruns:0 frame:0

  14. TX packets:390 errors:0 dropped:0 overruns:0 carrier:0

  15. collisions:0 txqueuelen:1000

  16. RX bytes:85058 (85.0 KB) TX bytes:62727 (62.7 KB)

  17. Lo Link encap:local Loopback

  18. inet addr:127.0.0.1 mask:255.0.0.0

  19. Inet6 addr::: 1/128 scope:host

  20. Up LOOPBACK RUNNING mtu:65536 metric:1

  21. RX packets:32 errors:0 dropped:0 overruns:0 frame:0

  22. TX packets:32 errors:0 dropped:0 overruns:0 carrier:0

  23. collisions:0 txqueuelen:0

  24. RX bytes:2368 (2.3 kb) TX bytes:2368 (2.3 kb)

650) this.width=650; "src=" http://img.blog.csdn.net/20160202174315694 "style=" border:none; "/>



Host Mode : In fact, the so-called container network is consistent with the host OS network, and in doing so, add the command parameter:--net host

Host represents the use of the host's network stack, the host host does not create a Veth virtual network card mapping.

650) this.width=650; "src=" http://img.blog.csdn.net/20160202174807184 "style=" border:none; "/>


In general, we access host-mode container objects by accessing the hosts ip+ port.

650) this.width=650; "src=" http://img.blog.csdn.net/20160202175026112 "width=" 803 "height=" style= "Border:none" />


Of course, if you consider the need for security, we can do port mapping.

Docker allows the internal container service port to be exposed by using port mapping

Use the-p parameter to specify the internal port of the container that needs to be exposed, and Docker automatically assigns (49000-49900) the port on one host to its mapping without specifying the corresponding port of the specific host

Use the-p parameter to indicate that all ports specified by expose are exposed in the image

650) this.width=650; "src=" http://img.blog.csdn.net/20160202175318613 "width=" 803 "height=" style= "Border:none" />



Container mode : And the role of the bridge through a container network, the other container network, and the container in the same network.

Container:{name|id}, use a different container network stack



Standalone Mode : All container networks within the host are isolated, and we can The none parameter, which indicates that the network connection for container is turned off


Storage Mounts

under normal circumstances, by adding the-v parameter, you can bind a directory on host to container and run container to read and write it .

650) this.width=650; "src=" http://img.blog.csdn.net/20160202180100991 "width=" 803 "height=" 432 "style=" Border:none; " />

Inter-container communication

Through the link parameter, the container port information is exposed to another container, to achieve the communication

650) this.width=650; "src=" http://img.blog.csdn.net/20160202180143288 "width=" 803 "height=" 438 "style=" border:none; " />



This article is from the "Mr_computer" blog, make sure to keep this source http://caochun.blog.51cto.com/4497308/1750763

docker-gis+ "Technology and industry solutions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.