1、确认修改前docker网段
[root@kfk12 ~]# ifconfig docker0
2、修改docker配置设置网段
[root@kfk12 ~]# cat > /etc/docker/daemon.json << EOF
{
"registry-mirrors": [
"https://vh3bm52y.mirror.aliyuncs.com",
"https://registry.cn-hangzhou.aliyuncs.com"
],
"bip": "192.168.10.1/24",
"log-level": "warn"
}
EOF
3、重启docker服务
[root@kfk12 ~]# systemctl daemon-reload && systemctl restart docker
4、查看最新网络配置
[root@kfk12 ~]# ifconfig docker0
5、查看容器网络配置
[root@kfk12 ~]# docker ps #确认运行的容器
[root@kfk12 ~]# docker inspect -f "{{ .NetworkSettings.IPAddress }}" n1 #查看容器IP