查看容器IP命令
root@VM-20-5-ubuntu:~/lb-from-scratch# docker ps -q| xargs -i docker inspect --format '{{ .NetworkSettings.IPAddress }} - {{ .NetworkSettings.MacAddress }} - {{ .ID }} - {{ .Name }}' {}
172.17.0.5 - 02:42:ac:11:00:05 - 40181faaa4ad33097d1b60b2bec29cf63ece6d9c1553a47171ae5d4db68ca541 - /client
172.17.0.2 - 02:42:ac:11:00:02 - d55f48fda1c6caf74404724141287e3fe645a7e0ceec6a8fb94bc2ff53c979bc - /lb
172.17.0.4 - 02:42:ac:11:00:04 - 1956ed75570f0330f38b3e2928bf793e3784b3573b780f1ace56e6474de376dc - /backend-B
172.17.0.3 - 02:42:ac:11:00:03 - 68c6351cefb16fc9e7e4c84898765608d6ff8b86dbd80d27cf2b7d263c1ec7b8 - /backend-A
root@VM-20-5-ubuntu:~/lb-from-scratch# docker ps -q| xargs -i docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}} - {{.MacAddress}}{{end}} - {{.ID}} - {{.Name}}' {}
172.17.0.5 - 02:42:ac:11:00:05 - 40181faaa4ad33097d1b60b2bec29cf63ece6d9c1553a47171ae5d4db68ca541 - /client
172.17.0.2 - 02:42:ac:11:00:02 - d55f48fda1c6caf74404724141287e3fe645a7e0ceec6a8fb94bc2ff53c979bc - /lb
172.17.0.4 - 02:42:ac:11:00:04 - 1956ed75570f0330f38b3e2928bf793e3784b3573b780f1ace56e6474de376dc - /backend-B
172.17.0.3 - 02:42:ac:11:00:03 - 68c6351cefb16fc9e7e4c84898765608d6ff8b86dbd80d27cf2b7d263c1ec7b8 - /backend-A
root@VM-20-5-ubuntu:~/lb-from-scratch# docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}} - {{.MacAddress}}{{end}} - {{.ID}} - {{.Name}}' $(docker ps -q)
172.17.0.5 - 02:42:ac:11:00:05 - 40181faaa4ad33097d1b60b2bec29cf63ece6d9c1553a47171ae5d4db68ca541 - /client
172.17.0.2 - 02:42:ac:11:00:02 - d55f48fda1c6caf74404724141287e3fe645a7e0ceec6a8fb94bc2ff53c979bc - /lb
172.17.0.4 - 02:42:ac:11:00:04 - 1956ed75570f0330f38b3e2928bf793e3784b3573b780f1ace56e6474de376dc - /backend-B
172.17.0.3 - 02:42:ac:11:00:03 - 68c6351cefb16fc9e7e4c84898765608d6ff8b86dbd80d27cf2b7d263c1ec7b8 - /backend-A
|