Running macOS and docker ubuntu on it, I am unable to ping my local network's IP addresses. Below is the network configuration of my docker container. I can ping my host machine's IP address but I am unable to access other IP addresses on the local network.
root# ping 172.17.101.192
PING 172.17.101.192 (172.17.101.192) 56(84) bytes of data.
From 172.17.0.3 icmp_seq=1 Destination Host Unreachable
From 172.17.0.3 icmp_seq=2 Destination Host Unreachable
root# ifconfig
eth0 Link encap:Ethernet HWaddr 02:42:ac:11:00:03
inet addr:172.17.0.3 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::42:acff:fe11:3/64 Scope:Link
Is there any network configuration which would help me to perform this operation?
I have tried net=host
but it is not helping it.
Most Docker Engine installations will represent the host as 172.17.0.1 on the default docker0 bridge network. You can check your own IP by running this command on your host: Your host’s Docker IP will be shown on the inet line. Connect to this IP address from within your containers to successfully access the services running on your host.
This might be a really weird or edge case scenario, but what If we need to access host service (s) from inside a Docker container. For instance, we already have configured and running a service on the dev host machine and kinda lazy to dockerize it. Docker supports a host-gateway reference to the host’s gateway.
In a script called docker-ip, place the following: And now we can get the ip address of a container like this: This uses the standard Docker network model combined with NAT rules on your host to redirect inbound traffic to/outbound traffic from the appropriate IP address. Assign our target address to your host interface:
I think docker internal network could be conflicting with your local network addressing. Try to run Docker changing the default internal network to something that doesn't conflict, as 172.31.0.0/24.
I was using docker for mac, the issue was docker internal network conflicting with my local network addressing.
To resolve the this issue, i need to go to Preferences
in the dokcer menu.
In Preferences menu Daemon>Advanced Menu
, i can supply other bip.
{
"bip" : "12.12.0.1/24"
}
Click apply and restart. The next time docker will start with internal network as 12.12.0.1/24
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With