docker启动失败
失败场景
failed to start daemon: Error initializing network controller: Error creating default "bridge" network: Failed to program NAT chain: ZONE_CONFLICT: 'docker0' already bound to a zone
# 失败指令
sudo dockerd --bug
INFO[2021-07-28T09:07:17.348862049-04:00] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address
DEBU[2021-07-28T09:07:17.348877950-04:00] Allocating IPv4 pools for network bridge (8fc4aced43dc68af57ede6de910ec603fa257b3161ec5c6b4f79194c8cee010c)
DEBU[2021-07-28T09:07:17.348884150-04:00] RequestPool(LocalDefault, 172.17.0.0/16, , map[], false)
DEBU[2021-07-28T09:07:17.348898750-04:00] RequestAddress(LocalDefault/172.17.0.0/16, 172.17.0.1, map[RequestAddressType:com.docker.network.gateway])
DEBU[2021-07-28T09:07:17.348908250-04:00] Request address PoolID:172.17.0.0/16 App: ipam/default/data, ID: LocalDefault/172.17.0.0/16, DBIndex: 0x0, Bits: 65536, Unselected: 65534, Sequence: (0x80000000, 1)->(0x0, 2046)->(0x1, 1)->end Curr:0 Serial:false PrefAddress:172.17.0.1
DEBU[2021-07-28T09:07:17.349017251-04:00] Firewalld passthrough: ipv4, [-t nat -C POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE]
DEBU[2021-07-28T09:07:17.356656525-04:00] Firewalld passthrough: ipv4, [-t nat -C DOCKER -i docker0 -j RETURN]
DEBU[2021-07-28T09:07:17.363868495-04:00] Firewalld passthrough: ipv4, [-D FORWARD -i docker0 -o docker0 -j DROP]
DEBU[2021-07-28T09:07:17.370223957-04:00] Firewalld passthrough: ipv4, [-t filter -C FORWARD -i docker0 -o docker0 -j ACCEPT]
DEBU[2021-07-28T09:07:17.376173314-04:00] Firewalld passthrough: ipv4, [-t filter -C FORWARD -i docker0 ! -o docker0 -j ACCEPT]
DEBU[2021-07-28T09:07:17.384284793-04:00] Firewalld: adding docker0 interface to docker zone
DEBU[2021-07-28T09:07:17.386330713-04:00] releasing IPv4 pools from network bridge (8fc4aced43dc68af57ede6de910ec603fa257b3161ec5c6b4f79194c8cee010c)
DEBU[2021-07-28T09:07:17.386388914-04:00] ReleaseAddress(LocalDefault/172.17.0.0/16, 172.17.0.1)
DEBU[2021-07-28T09:07:17.386418714-04:00] Released address PoolID:LocalDefault/172.17.0.0/16, Address:172.17.0.1 Sequence:App: ipam/default/data, ID: LocalDefault/172.17.0.0/16, DBIndex: 0x0, Bits: 65536, Unselected: 65533, Sequence: (0xc0000000, 1)->(0x0, 2046)->(0x1, 1)->end Curr:0
DEBU[2021-07-28T09:07:17.386429014-04:00] ReleasePool(LocalDefault/172.17.0.0/16)
DEBU[2021-07-28T09:07:17.386442314-04:00] daemon configured with a 15 seconds minimum shutdown timeout
DEBU[2021-07-28T09:07:17.386450414-04:00] start clean shutdown of all containers with a 15 seconds timeout...
DEBU[2021-07-28T09:07:17.386622616-04:00] found 0 orphan layers
DEBU[2021-07-28T09:07:17.387288222-04:00] Cleaning up old mountid : start.
DEBU[2021-07-28T09:07:17.387385023-04:00] Cleaning up old mountid : done.
failed to start daemon: Error initializing network controller: Error creating default "bridge" network: Failed to program NAT chain: ZONE_CONFLICT: 'docker0' already bound to a zone
[root@localhost network-scripts]
解决方案
删除网卡
# 删除网卡
ifconfig docker0 down
# 重载网卡
nmcli c reload docker0
其他指令
# 查看ip
ip add
ip -4 add