Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The Network Mode of Docker

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Docker's network model

Docker's network models can be roughly divided into five types. After Docker is installed, the host will create three networks by default, namely bridge network, host network and none network. You can use docker network ls command to view them.

1. None Network

In this network mode, the container only has lo loopback network and no other network cards. None Network can be specified at container creation time with--network=none. This type of network has no way to connect to the network, and a closed network can ensure the security of the container very well.

2. Host network

Specify by the command--network=host that the container using host mode can communicate with the outside world directly using the IP address of docker host, and the service port inside the container can also use the port of the host without NAT. The biggest advantage of host is that the network performance is relatively good, but the port already used on docker host cannot be used anymore, and the isolation of the network is not good.

3. bridge network

The default network mode of the container, docker will create a Linux bridge named docker0 when installed, in the case of not specifying--network, the container created will be hung on docker0 by default.

Start any container and view the newly generated NIC information

After creating a container, a new network interface is mounted on docker0, which is the virtual network card created when the container was created. The bridge pattern creates a separate network stack for containers, ensuring that processes within containers use separate network environments, enabling network isolation between containers and between containers and docker hosts.

4. Container mode

When creating a container, use--network=container:NAME_or_ID. This mode specifies that the container's network shares a Network Namespace with an existing container when creating a new container, but does not configure any network for the docker container. This docker container has no network card, IP, routing, etc., so you need to manually add network cards and configure IP for the docker container.

5.User-defined mode

There are three main network drivers available for user-defined mode: bridge, overlay, macvlan. Bridge drivers are used to create networks similar to the bridge mentioned earlier;overlay and macvlan drivers are used to create networks, IP, etc. across hosts.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report