我希望我的Docker容器(wp,mysql)具有“ Docker bridge”的IP作为网关,但事实并非如此。请考虑我绘制的网络图。目的是要对其进行更正,以便提供有关Docker网络如何工作的核心知识。带有问号的矩形对于我在Docker网络中的位置或相关性尚不清楚。 DockerNAT矩形可能需要更正。
ipconfig主机DockerNAT 以太网适配器vEthernet(DockerNAT):
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #2
Physical Address. . . . . . . . . : xx-xx-xx-xx-xx-xx
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
IPv4 Address. . . . . . . . . . . : 10.0.75.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
NetBIOS over Tcpip. . . . . . . . : Enabled
--
2a02:1800:100::43:1
195.130.131.3
195.130.130.3
NetBIOS over Tcpip. . . . . . . . : Enabled
docker网络检查桥
[
{
"Name": "bridge",
"Id": "6205fbb4b3245c57252338beb9b1f8622e0b726b8084c1fded884c8920165937",
"Created": "2018-12-01T09:47:14.4459709Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]
docker检查Wordpress容器
"Networks": {
"docker-wordpress-xdebug-phpunit_default": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"dcbaf41e8ca5",
"wordpress"
],
"NetworkID": "6e35e027c2528f99b0123fa120776b53deef1d97526d1f95351931ed4538d94d",
"EndpointID": "f9f1c37b4a19c112f4ec57432b3c960fdf072f5a4cf04df8d0be93582d07ad36",
"Gateway": "172.22.0.1",
"IPAddress": "172.22.0.3",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:16:00:03",
"DriverOpts": null
}
}
docker检查mysql容器
"Networks": {
"docker-wordpress-xdebug-phpunit_default": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"db",
"a60591925cee"
],
"NetworkID": "6e35e027c2528f99b0123fa120776b53deef1d97526d1f95351931ed4538d94d",
"EndpointID": "0a630b183b04284bbc4cf258618815bb6a665c9e07863d9bfcc57aeac16e8ec2",
"Gateway": "172.22.0.1",
"IPAddress": "172.22.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:16:00:02",
"DriverOpts": null
}
}
}