修改docker默认IP

IT
IT
IT
400
文章
1
评论
2021年2月28日22:12:31 评论 1,069 1976字阅读6分35秒

默认安装的docker一般是以网桥bridge模式提供一个网络,默认的地址是172.17.0.1/16

[root@jenkins jenkins]# ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host 
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:af:fd:4a brd ff:ff:ff:ff:ff:ff
inet 192.168.90.9/24 brd 192.168.90.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::1b77:75f:77c7:f882/64 scope link noprefixroute 
valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
link/ether 02:42:38:96:ae:e5 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever

如果发现这个docker0的网段跟已有网段冲突的话,只能修改

  • 停止正在运行的docker服务
[root@jenkins ~]# systemctl stop docker
  • 修改docker配置文件,添加新的网段信息
[root@jenkins ~]# vim /etc/docker/daemon.json
{
"registry-mirrors": ["https://00s5k4m1.mirror.aliyuncs.com"],"bip": "172.17.12.1/16"
}

修改docker默认IP

  • 启动Docker,再次查看网络,发现修改成功
[root@jenkins ~]# systemctl start docker
  • 查看IP
[root@jenkins ~]# ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host 
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:af:fd:4a brd ff:ff:ff:ff:ff:ff
inet 192.168.90.9/24 brd 192.168.90.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::1b77:75f:77c7:f882/64 scope link noprefixroute 
valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
link/ether 02:42:38:96:ae:e5 brd ff:ff:ff:ff:ff:ff
inet 172.17.12.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
继续阅读
  • 我的QQ
  • QQ扫一扫
  • weinxin
  • 我的头条
  • 头条扫一扫
  • weinxin
Docker 最后更新:2021-3-1
IT
  • 本文由 发表于 2021年2月28日22:12:31
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
Docker部署Apollo Apollo

Docker部署Apollo

安装docker $ cd /opt/ $ sudo git clone --depth=1 https://github.com/cncentoscn/setuptools.git $ cd set...
Docker安装redis Docker

Docker安装redis

下载镜像 # docker pull redis 创建目录 # mkdir -p /home/redis/data # mkdir -p /home/redis/config 从 Redis 官方下载...

您必须才能发表评论!