Docker custom network1. Introduction to custom network1. Introduction When starting a regular docker container, you can use --link to bind the container network, but it will be very troublesome once there are more containers. So to customize a docker network, Xiaobai recommends using the --link command. Custom network fixes the problem that docker0 containers cannot ping each other using container names. They can only ping each other using IP. However, our custom network can ping each other using IP or container name. 2. Command
2. Create a custom network1. Start the regular container and check whether the container can be pinged It is found that it is not pingable. Next, we try it with --link It is found that the container can be pinged after using --link. --link is recommended for novices. Next, let's try it with a custom network. 2. Create a custom network docker network ls View the network list There are many types of docker networks bridge mode host is consistent with the host network none Empty network Do not use the network docker network inspect View network details docker network create Create a custom network –driver Set the network type –subnet Set custom ip routing network group –gateway Set the default ip route for this network Here I started two containers and specified the container network with –net. You can see that you can directly ping the containers in the same network. It’s very simple. This is the end of this article about the detailed introduction of Docker custom network. For more relevant Docker custom network content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Solution for using Baidu share on Https page
Prerequisites Compose is a tool for orchestrating...
What are the benefits of learning HTML? 1: Easily...
mysql accidentally deleted data Using the delete ...
Table of contents 1. What is Javascript? 2. What ...
Similar to the code hosting service provided by G...
If your web application runs on only one machine,...
1. Table structure 2. Table data 3. The query tea...
Error description When we install Docker Desktop,...
This article shares the specific code for JavaScr...
HTTP Status Codes The status code is composed of ...
This article example shares the specific code of ...
1. Function Introduction sed (Stream EDitor) is a...
The World Wide Web Consortium (W3C) has released a...
nginx server nginx is an excellent web server tha...
I have been learning porters recently. I feel lik...