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

How Docker customizes the network

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will explain in detail how Docker customizes the network. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Docker custom network one. Introduction to Custom Network

1. Introduction

When you start a regular docker container, you can use-link to bind the container network, but once there are too many containers, it will be very troublesome, so to customize a docker network, rookies recommend using the-link command

Custom network fixed the problem that containers in docker0 cannot ping each other with container names. Only ip can be used to communicate with ping, but our custom network can communicate with each other by ip or container name.

two。 Command

Custom network command description docker network create create custom network docker network inspect view custom network details docker network ls view network list docker network connect different custom network interconnection docker network rm delete custom network II. Create a custom network

1. The regular container starts to check whether the container can ping.

It is found that it is impossible to communicate with ping, so let's try it with-link.

It is found that the container can communicate with ping after using-link.-link recommends Xiaobai to use it. Next, let's try it with a custom network.

two。 Create a custom network

Docker network ls View Network list

There are many types of docker networks.

Bridge bridging mode

The host is consistent with the host network

None empty network does not use network

Docker network inspect to view network details

Docker network create creates a custom network

-driver sets the network type

-subnet sets custom ip routing netgroups

-gateway sets the default ip route for this network

Here I start two containers and specify the network of the container with-net. You can see the container that can directly ping the same network, which is very simple.

This is the end of the article on "how to customize the network in Docker". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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

Development

Wechat

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

12
Report