1. Background When the Docker service is started, a docker0 bridge is created by default (with a docker0 internal interface on it), which connects other physical or virtual network cards at the kernel layer, putting all containers and the local host on the same physical network. By default, Docker specifies the IP address and subnet mask of the docker0 interface, allowing the host and container to communicate with each other through the bridge. It also gives the MTU (the maximum transmission unit allowed to be received by the interface), which is usually 1500 Bytes, or the default value supported by the host network routing. These values can be configured when the service is started. 2. Environment [root@iZ2ze278r1bks3c1m6jdznZ ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) [root@iZ2ze278r1bks3c1m6jdznZ ~]# uname -r 3.10.0-514.26.2.el7.x86_64 [root@iZ2ze278r1bks3c1m6jdznZ ~]# docker version Client: Version: 1.13.1 API version: 1.26 Package version: docker-1.13.1-75.git8633870.el7.centos.x86_64 Go version: go1.9.4 Git commit: 8633870/1.13.1 Built: Fri Sep 28 19:45:08 2018 OS/Arch: linux/amd64 Server: Version: 1.13.1 API version: 1.26 (minimum version 1.12) Package version: docker-1.13.1-75.git8633870.el7.centos.x86_64 Go version: go1.9.4 Git commit: 8633870/1.13.1 Built: Fri Sep 28 19:45:08 2018 OS/Arch: linux/amd64 Experimental: false 3. Modify the default docker0 bridge [root@iZ2ze278r1bks3c1m6jdznZ ~]# ifconfig docker0 docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.255.0 broadcast 0.0.0.0 ether 02:42:20:c4:fa:7a txqueuelen 0 (Ethernet) RX packets 63 bytes 4592 (4.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 44 bytes 4206 (4.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 We can see that the default network segment of docker0 is 172.xx.xx.xx Modify the file /etc/docker/daemon.json and add the content "bip": "ip/netmask" [Do not use the same network segment as the host] [root@iZ2ze278r1bks3c1m6jdznZ ~]# cat /etc/docker/daemon.json { "bip":"192.168.100.1/24" } 4. Restart the server [root@iZ2ze278r1bks3c1m6jdznZ ~]# systemctl restart docker 5. Check the network segment of docker0 [root@iZ2ze278r1bks3c1m6jdznZ ~]# ifconfig docker0 docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.100.1 netmask 255.255.255.0 broadcast 0.0.0.0 ether 02:42:20:c4:fa:7a txqueuelen 0 (Ethernet) RX packets 63 bytes 4592 (4.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 44 bytes 4206 (4.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 OK, here we have successfully modified the docker0 bridge. In the next article, I will explain how to access between containers and between containers and between containers and hosts. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Swiper.js plugin makes it super easy to implement carousel images
>>: MySQL 5.7.18 free installation version window configuration method
Table of contents Preface Method 1: High contrast...
1. The first parameter props of the setUp functio...
Table of contents Install and introduce axios dep...
Overview binlog2sql is an open source MySQL Binlo...
NodeJS copies the files: Generally, the copy oper...
Table of contents 1. Troubleshooting and locating...
Table of contents process Demo Mini Program Backe...
This article mainly introduces the pie chart data...
Copy code The code is as follows: <html> &l...
The download address of FlashFXP is: https://www....
Table of contents 1. Install JDK Manual Installat...
I recently encountered a feature while working on...
Table of contents Preface Check Constraints Creat...
What is content overflow? In fact, when there is ...
The project test environment database data is los...