'Not able to ping googl.com OR access any other docker from my Docker Container
My host machine is MAC and I have installed Docker on my machine.
1.) Have downloaded the mysql:5 image and started container from the same :-
docker container run -d -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=learners --network bridge mysql:5
2.) Now I have logged into the Docker container, using the default bridge :-
(base) aditya@aditya-MAC PROJECTS % docker container exec -it c4 bash
root@c4abb2947a1f:/usr/local/bin#
root@c4abb2947a1f:/usr/local/bin#
root@c4abb2947a1f:/usr/local/bin# ping google.com
PING google.com (142.250.193.238) 56(84) bytes of data.
^C
--- google.com ping statistics ---
7 packets transmitted, 0 received, 100% packet loss, time 2090ms
root@c4abb2947a1f:/usr/local/bin#
root@c4abb2947a1f:/usr/local/bin#
3.) On my host machine, here are networks I have :-
(base) aditya@aditya-MAC ~ % docker network ls
NETWORK ID NAME DRIVER SCOPE
c0bcfcc8b9ac aditya-network bridge local
197c1cbd4534 bridge bridge local
e7b2d1393818 docker-hadoop_default bridge local
cf84498b715b host host local
69dd81905f0a ksql-course-master_default bridge local
c0c5220ade8f none null local
(base) B0218162@APB-LTB0218162-MAC ~ %
Inside my docker, I am able to install any package like apt-get install iputils-ping.
Any help shall be highly appreciated.
Solution 1:[1]
- Update all Repos with command -> apt update
- Install iputils with command -> apt install iputils-ping This worked for my system so I guess it should work for you too.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shaktirajsinh Jadeja |
