我在swarm模式下运行docker,我在相同的覆盖网络上运行了一些服务但节点不同。
我试图让这些服务的节点能够相互通信;这工作正常,直到我尝试交叉节点。
以下是我的网络定义,来自一个节点:
{
"Name": "my-nw",
"Id": "0jk0h0sor0839i2j91rz8b7c9",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "10.0.0.0/24",
"Gateway": "10.0.0.1"
}
]
},
"Internal": false,
"Containers": {
"0467076e0f3b3618115a4d023e78a74921eb6ef7c7ba1e5baeffe1ea4500ee1e": {
"Name": "sleepy_fermi.2.59adig1cqoe6s5frqvwco3fyk",
"EndpointID": "7276764bd319c57f3343ff871db136e0a224eedb52e93dc8bb1e0d488bf6de83",
"MacAddress": "02:42:0a:00:00:04",
"IPv4Address": "10.0.0.4/24",
"IPv6Address": ""
},
"4554f04efa9c2d66e584fefa3d610314761f8dc6599f3723e878e6e5326cd21e": {
"Name": "sleepy_fermi.3.4jdpxy1zbu33tf55cbp24llbk",
"EndpointID": "b498650bac96aa780a88f0c7a0c70dc716e00b3a4852dcaaf22450d71712ef5f",
"MacAddress": "02:42:0a:00:00:05",
"IPv4Address": "10.0.0.5/24",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "257",
"encrypted": ""
},
"Labels": {}
}
这是来自另一个节点:
{
"Name": "my-nw",
"Id": "0jk0h0sor0839i2j91rz8b7c9",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "10.0.0.0/24",
"Gateway": "10.0.0.1"
}
]
},
"Internal": false,
"Containers": {
"68ae6de87b418168fdc708ea015d3b4130911124eab9821902d03de59eb91264": {
"Name": "sleepy_fermi.1.azu3d6fdjq1jovspok3xn0rrk",
"EndpointID": "dc485439790fa586c8c592f2e53f8bdb7e50142c560538349a70e2cda6e065a4",
"MacAddress": "02:42:0a:00:00:03",
"IPv4Address": "10.0.0.3/24",
"IPv6Address": ""
},
"f4fdacd84bf8b40dace568d3ced1635bec0f982f03566e043e59c29eccc2bf19": {
"Name": "tiny_montalcini.1.a3ovorl23ak351gozxr9o7nvt",
"EndpointID": "f3951430836fbb056e559e43de921b8c437f72d1ee0c59b4179220c6c0ea0eee",
"MacAddress": "02:42:0a:00:00:07",
"IPv4Address": "10.0.0.7/24",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "257",
"encrypted": ""
},
"Labels": {}
}
所以,例如,我可以卷曲sleepy_fermi.4。来自sleepy_fermi.5。但不是来自sleepy_fermi.3(ip-address也不起作用,因此它不仅仅是名称查找问题)。