Last active
August 29, 2015 14:08
-
-
Save andmarios/45073a53c408091e6dce to your computer and use it in GitHub Desktop.
Replace container IDs with container IPs for `docker ps`
This file contains 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
#!/usr/bin/env bash | |
docker ps | while read DLINE | |
do | |
CONTAINER="$(echo $DLINE | grep -Eo "^[a-f0-9]{12,12}")" | |
[[ ! -z "$CONTAINER" ]] && CIP="$(docker inspect $CONTAINER | grep IPAd | cut -d \" -f 4)" | |
echo "$DLINE" | sed -e "s/[a-f0-9]\{12,12\}/$CIP/" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment