Get the App
SLTechnology News&Howtos  ›  Servers  › 

What are the applicable scenarios for none and host networks

Shulou Source: shulou.com Published: 2022-06-01 00:50:37 10月28日 Update

What is the applicable scenario of none and host network? I believe many inexperienced people are at a loss about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

We will first learn about several native networks provided by Docker and how to create custom networks. Then it discusses how containers communicate with each other and how containers interact with the outside world.

Docker network can be divided into container network on a single host and network across multiple host in terms of coverage.

When Docker is installed, three networks are automatically created on host, which can be viewed with the docker network ls command.

Let's discuss them separately.

None network

Therefore, the name Siyi, none network is nothing of the network. The container hanging under this network does not have any network card except lo. When the container is created, you can specify the use of the none network with-- network=none.

We can't help but ask, what is the use of such a closed network?

Actually, there are application scenarios. Closeness means isolation, and some applications that require high security and do not need networking can use none networks.

For example, the only purpose of a container is to generate random passwords, which can be put into the none network to prevent passwords from being stolen.

Of course, most containers need a network, so let's move on to the host network.

Host network

Containers connected to the host network share the network stack of Docker host, and the network configuration of the container is exactly the same as host. You can specify the use of host networks with-- network=host.

You can see all the network cards of host in the container, and even hostname is host. What is the usage scenario of the host network?

The biggest advantage of using Docker host network directly is performance. If the container has higher requirements for network transmission efficiency, you can choose host network. Of course, the inconvenience is to sacrifice some flexibility, for example, to consider port conflicts, ports that are already in use on Docker host can no longer be used.

Another use of Docker host is to allow containers to configure host networks directly. For example, some cross-host network solutions, which themselves run as containers, require network configuration, such as managing iptables.

After reading the above, have you mastered the applicable scenarios of none and host networks? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Network container scene that is problem configuration content can be passed password scheme method more purpose port network card application inconvenience helpless for this reason three Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Xiaomi macOS Shulou Technology Docker