网络连通
[root@master ~]
[root@master ~]
[
{
"Name": "mynet",
"Id": "5f1e38310933ce7dbe7773742a53ec94bca5866d12b989127911cafe508d70fd",
"Created": "2022-05-10T15:56:05.138587918+08:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "192.168.0.0/16",
"Gateway": "192.168.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"16dc4719ce8c1c7c5690f228a88eed5fc59f61eaaeec2fe5a84c2a1093ae2082": {
"Name": "tomcat-net-01",
"EndpointID": "9806ce5af67bda13ecd41fb318f5c6524be8e42a988f9e5ff370a30b5d875b8a",
"MacAddress": "02:42:c0:a8:00:02",
"IPv4Address": "192.168.0.2/16",
"IPv6Address": ""
},
"2717187fc62d6f624f04f5af1accde7dd0ca6ab212f76272e96fd7d43dc0c093": {
"Name": "tomcat-net-02",
"EndpointID": "d908b92153b2728b27c9a3fa298a7938233ca4c8ff0d338ccab77d49727922dd",
"MacAddress": "02:42:c0:a8:00:03",
"IPv4Address": "192.168.0.3/16",
"IPv6Address": ""
},
"d0b0933f23228341015c88049fa84c350c9fcba70c26aa2146647c83e078b64b": {
"Name": "tomcat01",
"EndpointID": "7e3efccd2393bf71e51e8c0f9dd89a99e0441ba69a3c58f503408e45ae401f2b",
"MacAddress": "02:42:c0:a8:00:04",
"IPv4Address": "192.168.0.4/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {}
}
]
[root@master ~]
PING tomcat-net-01 (192.168.0.2) 56(84) bytes of data.
64 bytes from tomcat-net-01.mynet (192.168.0.2): icmp_seq=1 ttl=64 time=0.064 ms
64 bytes from tomcat-net-01.mynet (192.168.0.2): icmp_seq=2 ttl=64 time=0.056 ms
64 bytes from tomcat-net-01.mynet (192.168.0.2): icmp_seq=3 ttl=64 time=0.051 ms
[root@master ~]
ping: unknown host tomcat-net-01
结论:假设要跨网络操作别人,就需要使用docker network connect 连通!。。。
|