问题
1 2 3 4 5 6 7 8 9 10 11 12 13
| $ docker images Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
$ sudo service docker start Starting Docker: docker.
$ sudo service docker status Docker is not running ... failed!
$ sudo dockerd ... ... failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables --wait -t nat -N DOCKER: iptables v1.8.4 (nf_tables): CHAIN_ADD failed (No such file or directory): chain PREROUTING
|
解决方案
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| $ sudo update-alternatives --config iptables There are 2 choices for the alternative iptables (providing /usr/sbin/iptables).
Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/sbin/iptables-nft 20 auto mode 1 /usr/sbin/iptables-legacy 10 manual mode 2 /usr/sbin/iptables-nft 20 manual mode
Press <enter> to keep the current choice[*], or type selection number:1
$ sudo service docker start * Starting Docker: docker [ OK ] $ sudo service docker status * Docker is running
|
原因
docker没有针对新版的iptables修改程序,所以导致了docker的启动失败,只要将iptables的版本切到旧版就可以了。