I try to make two containers on different hosts communicate with each other on port 7000. But it never really happens. Is there any expert who can help me out?
docker service create --replicas 2 --network ingress --publish 7000 --name nc1 busybox ping docker.com
docker service create --replicas 2 --network ingress --publish 7000 --name nc2 busybox ping docker.com
-
docker exec container_id_of_nc1.1 sh
andnc -l 10.255.0.6:7000
-
docker exec container_id_of_nc2.2 sh
andnc 10.255.0.6 7000
and type random characters to send to nc1.1
Nothing happens on nc1.1.
I wonder if that is because one host is linux and the other is macos? Macos is running Docker For Mac by the way. The only weird thing I found when checking the configuration is macos node has a ip, 192.168.65.2. Does this cause the disconnection?
zhe@data-team-ws ~ % docker network inspect ingress
[
{
"Name": "ingress",
"Id": "95pgpv791m23d4wit39flr2ko",
"Created": "2017-03-22T14:30:43.594197923+08:00",
"Scope": "swarm",
"Driver": "overlay",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "10.255.0.0/16",
"Gateway": "10.255.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Containers": {
"55b7bf5f6698f75ef90d143a42a1600517d2ec6674a62561f3d314e263a77668": {
"Name": "nc2.1.wzlfcpzt30o1vdv8so26ffg0b",
"EndpointID": "365e641878badab356df9768ab88c0e2c1f71952b7765dee0a47be31cc2778a0",
"MacAddress": "02:42:0a:ff:00:0b",
"IPv4Address": "10.255.0.11/16",
"IPv6Address": ""
},
"5e43c4f8ed7985015be2385f44a76545c52499f018a94317b056150e19191700": {
"Name": "nc1.1.wz55df306ki7n4n0eahhueoli",
"EndpointID": "90dd9fa4f7749633d14e6d1834389d75cd31d7c52d5afe1aff192789b5b90b42",
"MacAddress": "02:42:0a:ff:00:06",
"IPv4Address": "10.255.0.6/16",
"IPv6Address": ""
},
"ingress-sbox": {
"Name": "ingress-endpoint",
"EndpointID": "931e3bcef799e6fdf833ce3c941aa9186f47c1e04b3fed0d870a96f4a25cf50e",
"MacAddress": "02:42:0a:ff:00:03",
"IPv4Address": "10.255.0.3/16",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.driver.overlay.vxlanid_list": "4096"
},
"Labels": {},
"Peers": [
{
"Name": "data-1bdc8c49fc3a",
"IP": "10.70.160.48"
},
{
"Name": "moby-670ea07b10e1",
"IP": "192.168.65.2"
}
]
}
]