How to change the network used by Docker?
By default, Docker virtualization system uses 172.17.0.0/12 networks for its operation. If your equipment uses addresses from these networks, you can change the Docker settings. This will prevent possible network conflicts.
Note
Performing actions from this article requires stopping the platform and rebooting the server with DCImanager.
Viewing the information about the networks used
To find out which networks are used by Docker:
-
Request the list of networks:
docker network list
CODE
An example of response
NETWORK ID NAME DRIVER SCOPE 14a38927e118 bridge bridge local b91a38ed491b dci_auth bridge local 7bdf76184b18 docker_ipmi_proxy_v2_bridge bridge local 2d9237551d88 etc_default bridge local f67c6099ef24 host host local cbb6fb4096c5 none null local
CODE
In the response to the command, the NAME column will show the names of the networks used.
-
Request the information about the address space used:
An example of commands with responses
[root@dci ~]# docker network inspect etc_default | grep Subnet "Subnet": "172.19.0.0/16", [root@dci ~]# docker network inspect docker_ipmi_proxy_v2_bridge | grep Subnet "Subnet": "172.26.0.0/16", [root@dci ~]# docker network inspect bridge | grep Subnet "Subnet": "172.17.0.0/16", [root@dci ~]# docker network inspect dci_auth | grep Subnet "Subnet": "172.25.0.0/16",
CODE
Changing the network for Docker
To change the settings of networks used by Docker:
-
Edit or create the /etc/docker/daemon.json file:
An example of file
{ "live-restore": true, "bip": "10.10.0.1/16", "default-address-pools": [{ "base": "10.0.0.0/8", "size": 16 }] }
CODE
live-restore — this parameter helps reduce container downtime when the system is shut down or rebooted.
bip — IP address of Docker’s bridge-interface in the format “address/network prefix”. For example, to use the IP address 10.10.0.1 in a 10.10.0.0/16 network, specify “10.10.0.1/16”.
base — the range of IP addresses for creating Docker networks in the format “network/network prefix”. E.g., “10.0.0.0/8”.
size — prefix of networks being created.
-
Delete all running docker containers:
docker rm -f `docker ps -q -a`
CODE
-
Delete all unused Docker objects:
docker system prune
CODE
docker network prune
CODE
-
Restart the Docker service:
systemctl restart docker
CODE
-
Run DCImanager:
dci start
CODE
-
Run the BMC proxy module’s docker containers:
docker-compose -f /opt/ispsystem/ipmi_proxy_service/etc/docker/ipmi_proxy_v2.yml up -d
CODE
-
Run docker containers for working with locations:
docker-compose -f /opt/ispsystem/dci/etc/location.yaml up -d
CODE
-
Reboot the server with DCImanager:
reboot
CODE
-
Check the network settings:
Examples of commands with responses
[root@dci6 ~]# docker network inspect bridge | grep Subnet "Subnet": "10.10.0.0/16", [root@dci6 ~]# docker network inspect dci_auth | grep Subnet "Subnet": "10.0.0.0/16", [root@dci6 ~]# docker network inspect docker_ipmi_proxy_v2_bridge | grep Subnet "Subnet": "10.1.0.0/16", [root@dci6 ~]# docker network inspect etc_default | grep Subnet "Subnet": "10.2.0.0/16",
CODE