【docker】docker启动、重启、关闭命令,附带:docker启动容器报错:docker: Error response from daemon: driver failed programming external connectivity on endpoint es2-node

在关闭并放置centos 的防火墙重启之后【操作:https://www.cnblogs.com/sxdcgaq8080/p/10032829.html

启动docker容器就发现开始报错:

[root@localhost elasticSearch]# docker run -d --name es2-node -p 9201:9200 -p 9301:9300 --restart=always -v /apps/elasticSearch/es2.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /apps/elasticSearch/es2_data:/usr/share/elasticsearch/data elasticsearch:5.6.9
a357eb4b695a6fec33f2093267bfe0015acb35fbb81688dd336ed30336e8bd9f
docker: Error response from daemon: driver failed programming external connectivity on endpoint es2-node (38cbd7b4a49c5f32f6ac8f0bf4a4bdf158e50e728b12ba5bbe801f741fc78003):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 9301 -j DNAT --to-destination 172.17.0.2:9300 ! -i docker0: iptables: No chain/target/match by that name.
 (exit status 1)).

但是 实际上并没有冲突的容器存在。

 

实际原因:

docker服务启动时定义的自定义链DOCKER由于某种原因被清掉
重启docker服务及可重新生成自定义链DOCKER

 

解决方法:

启动            systemctl start docker
守护进程重启      sudo systemctl daemon-reload
重启docker服务    systemctl restart  docker
重启docker服务    sudo service docker restart
关闭docker       service docker stop   
关闭docker       systemctl stop docker

 

posted @ 2018-11-28 16:46  Angel挤一挤  阅读(580)  评论(0编辑  收藏  举报