Last active
June 15, 2017 15:49
-
-
Save thbkrkr/92bb5624b459d2e0d6be87d433ad1a62 to your computer and use it in GitHub Desktop.
List IP of all containers of a Swarm cluster
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
| # list_ips kaastor faas_functions | |
| list_ips() { | |
| declare filterName=$1 network=$2 | |
| for m in $(docker-machine ls -q); do | |
| echo -- $m | |
| eval $(set_docker_env $m) | |
| for ID in $(docker ps --filter=name=$filterName --format={{.ID}}); do | |
| docker inspect $ID | jq -c '.[] | { | |
| name:.Name, | |
| ip:.NetworkSettings.Networks.'$network'.IPAddress | |
| }' | |
| done | |
| done | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment