I have an external server abc.internalcorp.com that I'm planning to connect from docker.
I tried to ping that server from host machine and it works.
ping abc.internalcorp.com
PING abc.internalcorp.com (172.xx.xx.xx) 56(84) bytes of data.
64 bytes from abc.internalcorp.com (172.xx.xx.xx): icmp_seq=1 ttl=47 time=32.6 ms
^C
--- abc.internalcorp.com ping statistics ---
2 packets transmitted, 1 received, 50% packet loss, time 999ms
rtt min/avg/max/mdev = 32.673/32.673/32.673/0.000 ms
But when I execute the same command from my docker container, I see no response. How could this be?
docker exec -ti docker-container bash
root@b7bdf44feb7f:/# ping abc.internalcorp.com
PING abc.internalcorp.com (172.xx.xx.xx) 56(84) bytes of data.
<No response>
This ping is just a test. abc.internalcorp.com is actually a database server and I'm unable to connect to it. I can connect to other database servers though.
Update: I changed bip in ~/.docker/daemon.json
{
"bip": "193.168.1.5/24",
"registry-mirrors": [],
"insecure-registries": [],
"debug": true,
"experimental": false
}
But I still have the same ping issue
docker exec -ti docker-container bash
root@b7bdf44feb7f:/# ip addr show eth0
10: eth0@if11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:c1:a8:01:01 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet 193.168.1.1/24 brd 193.168.1.255 scope global eth0
valid_lft forever preferred_lft forever
Edit Figured out the issue. There were other networks in my docker that were having the same network subnets. Deleted them and works fine now