docker 容器内ping 另一个容器明
失败
- 涉及容器
- qinglong
- jupyter
qinglong里ping jupyter
- 失败代码
[root@iZbp18y7b5jm99960ajdloZ ~]# docker exec -it qinglong ping jupyter
ping: bad address 'jupyter'
两容器正常启动
[root@iZbp18y7b5jm99960ajdloZ ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 17dcadac93e1 zookeeper:3.4.9 "/docker-entrypoint.…" 7 hours ago Up 7 hours 2888/tcp, 0.0.0.0:2181->2181/tcp, 3888/tcp zookeeper 350c27dd6d07 jupyter/datascience-notebook "tini -g -- start-no…" 7 weeks ago Up 24 hours (healthy) 0.0.0.0:8888->8888/tcp jupyter 287d6170e13c whyour/qinglong:2.12 "./docker/docker-ent…" 7 weeks ago Up 24 hours 0.0.0.0:15700->5700/tcp qinglong b7d81a4a3fd8 redis:5.0.14 "docker-entrypoint.s…" 2 months ago Exited (137) 25 hours ago redis 8d34783feaa8 mysql:5.7.37 "docker-entrypoint.s…" 2 months ago Up 24 hours 0.0.0.0:3306->3306/tcp, 33060/tcp mysql2 [root@iZbp18y7b5jm99960ajdloZ ~]#
两容器在同一张网卡
[root@iZbp18y7b5jm99960ajdloZ ~]# docker network inspect bridge [ { "Name": "bridge", "Id": "42ebf518e86e4ca08ee47c0a7d3839d9c23ef24d1e3511d2bdfdaf65975327f9", "Created": "2022-06-23T20:07:55.613373918+08:00", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": null, "Config": [ { "Subnet": "172.18.0.0/16", "Gateway": "172.18.0.1" } ] }, "Internal": false, "Attachable": false, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": { "17dcadac93e10da4c52b11867c42450a99a6c4848e397a0b7cab6d1b9c142f75": { "Name": "zookeeper", "EndpointID": "713126dd4481f6cce80fd8cfaba13239807716bbbd028466b3e35a05b1cfc901", "MacAddress": "02:42:ac:12:00:05", "IPv4Address": "172.18.0.5/16", "IPv6Address": "" }, "287d6170e13c90e9446c4988287cc0bdac06a1ec2776d208564e20b52002fc1a": { "Name": "qinglong", "EndpointID": "a987e4aacb11aab4c3b38979e2b87b75bc2abb6352dbc8dc3622b6b837c4897f", "MacAddress": "02:42:ac:12:00:02", "IPv4Address": "172.18.0.2/16", "IPv6Address": "" }, "350c27dd6d07ab89bdd63005beb86df886cf4f660be816d10968ebd985651aea": { "Name": "jupyter", "EndpointID": "c530c13ebd5c20c2deb3d94db62701b976317d63d36576b7f21a7a08335ecae3", "MacAddress": "02:42:ac:12:00:04", "IPv4Address": "172.18.0.4/16", "IPv6Address": "" }, "8d34783feaa8a2d8ee465d8b494b045c51e9c21f4be176dcda68b4d8ea2b293a": { "Name": "mysql2", "EndpointID": "f2d99e85aa50e79fa67f323f9b81f86db44ee8c82c84409a02f3dea68b2c56d1", "MacAddress": "02:42:ac:12:00:03", "IPv4Address": "172.18.0.3/16", "IPv6Address": "" } }, "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": {} } ] [root@iZbp18y7b5jm99960ajdloZ ~]#