2.2 Docker four types of network modes

Source: Internet
Author: User

Docker Network Management-Four network modes



* Host mode (Network of containers, residing on host. The container is the same as the host network. )

Use--net=host to specify when using Docker run

The network that Docker uses is actually the same as a host, and the IP card that is seen in the container is the IP on the host. Equivalent to a host-hosted network. It has some limitations, such as the container opened 80 port, host also opened 80 port, will create a conflict.

For example: Docker run-it--rm--net=host CentOS bash #退出容器, automatically removes containers.

* Container mode (multiple containers, shared IP for a specified container)

Using--net=container:container_id CentOS Bash

Multiple containers Use the specified container's network, see all the container IP is the same container:container_id the first is a fixed format, the second is the ID of the specified container, so that when the new container is started, the new IP and ID are the same as the IP and ID of the specified ID container.

* None mode

Use--net=none to specify

In this mode, no network is configured

* Bridge mode

Use--net=bridge to specify

Default mode, this network mode is not specified by default. This mode assigns a separate network Namespace to each container. A NAT network mode similar to VMware. All containers on the same host will be able to communicate with each other under the same network segment.


2.2 Docker four types of network modes

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.