Created
March 15, 2018 15:41
-
-
Save scottcreynolds/1cbe589114b38ba9fab6c56ce2e03592 to your computer and use it in GitHub Desktop.
A simple tool to show the IP address of each container on a server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in $(docker ps | awk '{print $1 ":" $2}') | |
do | |
container_id=$(echo $i | awk -F ':' '{print $1}') | |
container_service=$(echo $i | awk -F ':' '{print $2}') | |
container_ip_address=$(weave ps | grep $container_id | awk '{print $NF}') | |
echo "${container_service} : ${container_ip_address}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment