Docker Network Configuration

Source: Internet
Author: User

Network Configuration for Docker containers


Docker automatically creates a DOCKER0 bridge and automatically assigns an IP segment when it starts. How do you change the IP of Docker?

Ip addr Show can view Docker0 's network information

IP addr del 172.17.0.1/16 dev docker0 delete original IP

IP addr Add 172.25.25.1/24 dev Docker0 adding a new IP

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/85/E6/wKiom1etpCPCYjmZAABhyxPmBiw172.png "style=" float: none; "Title=" screenshot from 2016-08-12 16-34-13.png "alt=" Wkiom1etpcpcyjmzaabhyxpmbiw172.png "/>

This adds a temporary IP message that restarts the device and reverts to the initial IP how to permanently change the Docker network


Systemctl Stop Docker first closes Docker

Cd/lib/systemd/system

Cp Docker.service Docker.service.bak Save a Docker profile to a backup

Vim Docker.service Editor

...

Execstart=/usr/bin/docker daemon-h fd://--bip= "172.25.25.1/24"

Added:--bip= "172.25.25.1/24" required to change the IP

...

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/85/E6/wKioL1etpCOBgIW5AABylJs_qhk407.png "style=" float: none; "Title=" screenshot from 2016-08-12 18-07-16.png "alt=" Wkiol1etpcobgiw5aabyljs_qhk407.png "/>

Save exit

Systemctl Daemon-reload Reread configuration information

Systemctl Restart Docker restart Docker service

IP addr Show


650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/85/E6/wKiom1etpCLgbhrwAAA21obf6T0883.png "style=" float: none; "Title=" screenshot from 2016-08-12 18-19-06.png "alt=" Wkiom1etpclgbhrwaaa21obf6t0883.png "/>

Docker Network Configuration

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.