In addition to the default Docker0 bridge, start the Docker service how to specify which bridge to use

Source: Internet
Author: User

Custom Network Bridge

In addition to the default bridge docker0 , users can specify a bridge to connect to each container.

Use -b BRIDGE or to specify the bridge to use when starting the Docker service --bridge=BRIDGE .

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 

BRIDGE0

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

Review the confirmation bridge creation and launch.

$ IP Addr Show bridge04:bridge0: <BROADCAST,MULTICAST> MTU 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/24 scope global bridge0 Valid_lft forever preferred_lft for Ever

Configure the Docker service, which is the default bridge to the created bridge.

$ 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 bridge0 .

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


This article is from the "Dream to Reality" blog, please be sure to keep this source http://lookingdream.blog.51cto.com/5177800/1789556

To start the Docker service, in addition to the default Docker0 bridge, how to specify the network bridge to use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.