无法从Docker容器访问本地网络IP [英] Unable to access local network IP from docker container
问题描述
在其上运行macOS和docker ubuntu,我无法对本地网络的IP地址执行ping操作.以下是我的docker容器的网络配置.我可以ping通主机的IP地址,但是无法访问本地网络上的其他IP地址.
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?
我已经尝试过net=host
,但是它没有帮助.
I have tried net=host
but it is not helping it.
推荐答案
我在Mac上使用docker,问题是docker内部网络与我的本地网络地址冲突.
要解决此问题,我需要进入dokcer菜单中的Preferences
.
在偏好设置"菜单Daemon>Advanced Menu
中,我可以提供其他bip.
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"
}
单击应用",然后重新启动.下次docker将以内部网络12.12.0.1/24
开始.
Click apply and restart. The next time docker will start with internal network as 12.12.0.1/24
.
这篇关于无法从Docker容器访问本地网络IP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!