My docker container has no internet

+1 vote
My docker has no internet. The last time I used it was working fine. I’ve tried these following commands but not helping.

docker run -dns base ping

docker run base ping

sysctl -w net.ipv4.ip_forward=1 - both on the host and on the container

All I get is unknown host Docker version 0.7.0

Any help will be appreciated..
Jul 31, 2018 in Docker by Hannah
• 14,040 points

5 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
+1 vote
Best answer

Try resetting all the parameters

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

It will force docker to recreate the bridge and reinit all the network rules

answered Jul 31, 2018 by Kalgi
• 35,640 points

selected May 7 by Vardhan
0 votes

The most common reason for this error is if the container holds an invalid DNS. Then the container will not be able to resolve the domain name into IP addresses. And hence the ping will also fail. Run the following command to check for DNS server:

cat /etc/resolv.conf
answered May 6 by Faziba
0 votes

Restarting Docker worked for me. Restart it using the following command:

service docker restart
answered May 6 by Aysha
0 votes

If you're running Docker on OSX, do the following:

docker-machine restart
<...wait for it to restart, which takes up to a minute...>
docker-machine env
eval $(docker-machine env)
answered May 6 by Nishant
0 votes

For me, it was the host's firewall. I had to allow DNS on the host's firewall. And also had to restart docker after changing the host firewall setting.

answered May 6 by Tina

Related Questions In Docker

+2 votes
6 answers
0 votes
2 answers

Can't access apache karaf docker container

To access karaf shell directly you can ...READ MORE

answered Aug 6, 2018 in Docker by Nilesh
• 6,900 points
0 votes
1 answer

Different file owner inside Docker container and in host machine Ask

Filesystems, at least in Unix- and Linux-like ...READ MORE

answered Jun 25, 2018 in Docker by Damon Salvatore
• 5,250 points
0 votes
1 answer

Different file owner inside Docker container and in host machine

Here is what you can try. Since ...READ MORE

answered Jun 27, 2018 in Docker by Atul
• 10,170 points
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,100 points
+4 votes
4 answers

How To Access a Service on Host From a Docker Container?

Adding to kalgi's answer, You can also ...READ MORE

answered Oct 16, 2018 in Docker by lina
• 8,100 points

edited Oct 16, 2018 by lina 1,910 views
+2 votes
11 answers

How can I run a ‘docker exec’ command inside a docker container?

I guess there’s no docker runtime in ...READ MORE

answered 5 days ago in Docker by Frank

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.