我有连接到两个不同网络的docker容器,我试图找出如何从一个网络ping到另一个网络,最好使用容器名称。
docker network ls
NETWORK ID NAME DRIVER SCOPE
96a96d4aac62 awxcompose_default bridge local <- Container attached to this network needs to ping ...
e9dacd09a09f bridge bridge local
bd69c57e325d host host local
2f1e0812a31b lab_default bridge local <- ... a container on this network.
37ccfd915f3d none null local
容器是通过docker-compose部署的,因此网络名称和IP地址是随机的。
Newtork:awxcompose_default
ba5d4d437e2c ansible/awx_task:11.2.0 "tini -- /bin/sh -c …" 2 hours ago Up 2 hours 8052/tcp awx_task
e980748c8540 ansible/awx_web:11.2.0 "tini -- /bin/sh -c …" 2 hours ago Up 2 hours 0.0.0.0:4080->8052/tcp awx_web
Newtork:lab_default
62779b8167aa jenkins/jenkins:latest "/sbin/tini -- /usr/…" 25 hours ago Up 25 hours 0.0.0.0:8080->8080/tcp, 0.0.0.0:50000->50000/tcp jenkins
830fe6d02a30 gitlab/gitlab-ce:latest "/assets/wrapper" 25 hours ago Up 25 hours (healthy) 0.0.0.0:5022->22/tcp, 0.0.0.0:5080->80/tcp, 0.0.0.0:50443->443/tcp gitlab