Niklas Rosencrantz
Niklas Rosencrantz

Reputation: 26681

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?

Upvotes: 1

Views: 352

Answers (2)

Niklas Rosencrantz
Niklas Rosencrantz

Reputation: 26681

I was behind a proxy and the solution was to set the ip number of the proxy in ~/.docker/config.json instead of the name.

Upvotes: 1

Sachin Kale
Sachin Kale

Reputation: 11

hi can you check your network interface eth0 or whatever name or restart network interface ifdown eth0

ifup eth0

if instance in vpc then check NAT or internet gateway is there to make connection to internet

Upvotes: 1

Related Questions