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 modify docker to start the default bridge docker0 to a custom bridge

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

Share

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

This article mainly introduces how to modify the docker startup default bridge docker0 to customize the bridge, the article introduces in great detail, has a certain reference value, interested friends must read it!

Custom Brid

In addition to the default docker0 bridge, you can also specify a bridge to connect individual containers.

When starting the Docker service, use-b BRIDGE or-- bridge=BRIDGE to specify the bridge to use.

If the service is already running, you need to stop the service and delete the old bridge.

$sudo service docker stop$ sudo ip link set dev docker0 down$ sudo brctl delbr docker0

Then create a bridge bridge0.

$sudo brctl addbr bridge0 $sudo ip addr add 192.168.5.1 Plus 24 dev bridge0 $sudo ip link set dev bridge0 up

Check to confirm that the bridge is created and started.

$ip addr show bridge04: bridge0: mtu 1500 qdisc noop state UP group default link/ether 66:38:d0:0d:76:18 brd ff:ff:ff:ff:ff:ff inet 192.168.5.1 Universe 24 scope global bridge0 valid_lft forever preferred_lft forever

Configure the Docker service to bridge to the created bridge by default.

$echo 'DOCKER_OPTS= "- b=bridge0" > / etc/default/docker$ sudo service docker start

Start the Docker service. Create a new container and you can see that it has been bridged to the bridge0.

You can continue to view bridging information with the brctl show command. In addition, you can use the ip addr and ip route commands in the container to view the IP address configuration and routing information.

The above is all the contents of the article "how to modify docker to start the default bridge docker0 to customize the bridge". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to 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