Error response from daemon: driver failed programming external connectivity on endpoint mysql

Error response from daemon: driver failed programming external connectivity on endpoint mysql

  • 项目场景:
  • 问题描述
  • 解决方案:

项目场景:

当我在docker中运行mysql容器的时候,由于在安装过程中关闭了一次防火墙,所以出现以下错误

docker: Error response from daemon: driver failed programming external connectivity on endpoint mysql (7bacc7d5fe7ddaea10d4838de3ad4193844a9c3042aa303c757564d6749c0406):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 3306 -j DNAT --to-destination 172.17.0.2:3306 ! -i docker0: iptables: No chain/target/match by that name.
 (exit status 1)).

问题描述

详细错误信息如下所示:

[root@localhost ~]# docker run -d \
>   --name mysql \
>   -p 3306:3306 \
>   -e TZ=Asia/Shanghai \
>   -e MYSQL_ROOT_PASSWORD=123 \
>   mysql
a64aff6c04e7aa9cbe585b2ac595a4b3248c7af5a8af2b7d59d25ae464d77da4
docker: Error response from daemon: driver failed programming external connectivity on endpoint mysql (7bacc7d5fe7ddaea10d4838de3ad4193844a9c3042aa303c757564d6749c0406):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 3306 -j DNAT --to-destination 172.17.0.2:3306 ! -i docker0: iptables: No chain/target/match by that name.
 (exit status 1)).

解决方案:

使用如下命令重新启动docker即可。

systemctl restart docker

你可能感兴趣的:(bug,mysql,docker)