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 to customize the Bridge in Docker

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article is about how to customize the bridge in Docker. I think it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it.

You can also specify a bridge to connect each container, as follows:

1. First install the bridge-utils toolkit

$sudo apt-get install bridge-utils

Then you can use "brctl show" to view the current bridge information, and you can see that there is only one docker0.

$brctl show

Bridge name bridge id STP enabled interfaces

Docker0 8000.56847afe9799 no

two。 Then create a bridge br0

$sudo brctl addbr br0

$sudo ip addr add 192.168.66.1 Max 24 dev br0

$sudo ip link set dev br0 up

After being added, you can use "brctl show" to view it.

$brctl show

Bridge name bridge id STP enabled interfaces

Br0 8000.000000000000 no

Docker0 8000.56847afe9799 no

3. Edit the / etc/default/docker.io file and add the following Docker parameter. Docker uses the newly added bridge by default.

DOCKER_OPTS= "- b=br0"

4. Restart the docker service

Sudo service docker.io restart

5. Create a new container and you can see that it has been bridged to the br0.

6. Finally, if you want to delete the bridge, you can

$sudo ip link set dev br0 down

$sudo brctl addbr br0

Sudo brctl addbr br0

The above is how to customize the bridge in Docker. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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