Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save scottcreynolds/1cbe589114b38ba9fab6c56ce2e03592 to your computer and use it in GitHub Desktop.
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
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