简体   繁体   English

我无法让 Docker 容器访问互联网?

[英]I can't get Docker containers to access the internet?

I'm my wits end with this, I've combed every single google result and nothing helps.我的智慧就此结束,我梳理了每一个谷歌结果,没有任何帮助。

I'm completely unable to get docker containers to access the internet.我完全无法让 docker 容器访问互联网。 IP forwarding is enabled ( net.ipv4.ip_forward = 1 ), ufw is turned off, I've tried adding the -dns 8.8.8.8 -dns 8.8.4.4 flags. IP 转发已启用( net.ipv4.ip_forward = 1 ),ufw 已关闭,我尝试添加-dns 8.8.8.8 -dns 8.8.4.4标志。 Every possible solution I've ever found on google fails.我在谷歌上找到的每一个可能的解决方案都失败了。

Anyone have any idea how to help?任何人都知道如何提供帮助?

Attempting to reset everything, as recommend here causes the entire thing to break by telling me that docker -d isn't running even though it is.尝试重置所有内容,正如这里推荐的那样,告诉我docker -d没有运行,即使它正在运行,也会导致整个事情中断。

I was facing the same problem.我面临同样的问题。 So, to solve that issue I've started the container using the argument --net=host , it worked perfectly for me.因此,为了解决这个问题,我使用参数--net=host启动了容器,它对我来说非常有效。

Here goes the full statement这是完整的声明

sudo docker start --net=host -it --name ex_ngninx ubuntu

Resolved.解决。 I followed these instructions : commented out dns=dnsmasq line in NetworkManager.conf我按照以下说明操作:在NetworkManager.conf注释掉dns=dnsmasq

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM