Created
January 9, 2016 20:25
-
-
Save frontdevops/d988750600eaff6b005c to your computer and use it in GitHub Desktop.
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
# add this file in your .bashrc file: | |
# source docker.sh | |
dockerip() { | |
docker inspect --format '{{ .NetworkSettings.IPAddress }}' "$@" | |
} | |
dockerips() { | |
for dock in $(docker ps | tail -n +2 | cut -d" " -f1) | |
do | |
local dock_ip=$(dockerip $dock) | |
[[ -n "$dock_ip" ]] && regex="s/$dock\s\{3\}/${dock:0:3} $dock_ip/g;$regex" | |
done | |
docker ps -a | sed -e "$regex" | |
} | |
#EOF# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment