Docker:“驱动程序在端点测试容器上编程外部连接失败”

问题描述 投票:0回答:3

我在 manjaro VMware 中创建 python3 容器时收到以下错误:

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

(退出状态1))`

我不明白问题是什么?

docker文件:

FROM python:3.7-alpine

RUN adduser -D test`

WORKDIR /home/testapp`

ADD ./webapp/requirements.txt requirements.txt`

RUN pip3 install --upgrade pip

RUN pip3 install -r requirements.txt`

RUN pip3 install gunicorn

ADD ./webapp webapp/`

ENV FLASK_APP app.py

USER test

EXPOSE 5000
ENTRYPOINT ["./app.py"]
python-3.x docker containers manjaro
3个回答
10
投票

为了清楚起见,评论部分链接的线程对我有用的答案是:

# Enter below command, it will clear all chains.
$ sudo iptables -t filter -F
$ sudo iptables -t filter -X
# Then restart Docker Service using below comamnd
$ sudo systemctl restart docker

https://github.com/moby/moby/issues/16816#issuecomment-327074574


3
投票

我最近遇到了这个。防火墙没有按照错误提示运行。

解决方案:

systemctl start firewalld

重启防火墙后,能够正常启动容器,没有报错。

可能不是导致此错误的唯一原因,但在我使用 Ubuntu 20.04 LTS (ARM64) 的情况下,防火墙关闭会产生此错误。


0
投票
followed Ricky's steps above, and it worked
# Enter below command, it will clear all chains.
$ sudo iptables -t filter -F
$ sudo iptables -t filter -X
# Then restart Docker Service using below command
$ sudo systemctl restart docker

thanks!
© www.soinside.com 2019 - 2024. All rights reserved.