简体   繁体   English

无法从Docker容器连接到Internet

[英]Cannot connect to internet from docker container

$ docker run -it busybox
Unable to find image 'busybox:latest' locally
latest: Pulling from library/busybox
90e01955edcd: Pull complete
Digest: sha256:2a03a6059f21e150ae84b0973863609494aad70f0a80eaeb64bddd8d92465812
Status: Downloaded newer image for busybox:latest
/ # ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
^C
--- 8.8.8.8 ping statistics ---
285 packets transmitted, 0 packets received, 100% packet loss
/ #

Why does this happen? 为什么会这样? What can I do to resolve it? 我该怎么解决?

hi can you check your network interface eth0 or whatever name or restart network interface ifdown eth0 嗨,您能否检查您的网络接口eth0或其他名称,或者如果downeth0重启网络接口

ifup eth0 ifup eth0

if instance in vpc then check NAT or internet gateway is there to make connection to internet 如果vpc中的实例,则检查NAT或Internet网关是否存在以建立与Internet的连接

我在代理后面,解决方案是在〜/ .docker / config.json中设置代理的IP地址而不是名称。

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

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