docker启动报错iptables
·
启动容器时报错
报错内容:
iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 3306 -j DNAT --to-destination 192.168.xx.xx:80 ! -i docker0
iptables: No chain/target/match by that name. (exit status 1)).
重启docker时报错
systemctl restart docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xeu docker.service" for details.
重启docker报错
journalctl -u docker.service -n 100 --no-pager
查看日志
failed to find iptables: exec: "iptables": executable file not found in $PATH
failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to register "bridge" driver: failed to create NAT chain DOCKER: iptables not found
发现是系统缺少 iptables命令,安装iptables
# 更新包列表
sudo apt-get update
# 安装 iptables
sudo apt-get install -y iptables
安装后仍然找不到 iptables
查找 iptables 位置
sudo find /usr -name “iptables” -type f
sudo find /sbin -name “iptables” -type f
dpkg -L iptables | grep bin
创建符号链接
sudo ln -sf /usr/sbin/iptables-nft /usr/sbin/iptables
sudo ln -sf /usr/sbin/ip6tables-nft /usr/sbin/ip6tables
``
验证是否安装成功
iptables --version
测试重启容器成功
更多推荐

所有评论(0)