gpt4 book ai didi

ubuntu - Docker 容器内没有互联网连接

转载 作者:行者123 更新时间:2023-12-04 18:56:10 27 4
gpt4 key购买 nike

我无法在任何 Docker 容器内执行任何需要 Internet 连接的命令。

作品:

docker run ubuntu /bin/echo 'Hello world'

不工作:
docker run ubuntu apt-get update

Err:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-security/InRelease Temporary failure resolving 'archive.ubuntu.com'

类似于 pipping .

我在 Ubuntu 16.04 上,没有使用防火墙或公司代理服务器,并尝试重新启动 Docker。不使用 docker-machine 或 boot2docker。

最佳答案

Got answer on SuperUser:

pkill docker
iptables -t nat -F
ifconfig docker0 down
brctl delbr docker0
docker -d

“它将迫使 docker 重新创建网桥并重新初始化所有网络规则”

关于ubuntu - Docker 容器内没有互联网连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39828185/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com