Skip to content

Instantly share code, notes, and snippets.

@kokigit
Created October 29, 2019 12:49
Show Gist options
  • Save kokigit/19baa042d0745bcda6c3f96fb7a75904 to your computer and use it in GitHub Desktop.
Save kokigit/19baa042d0745bcda6c3f96fb7a75904 to your computer and use it in GitHub Desktop.
How to know service is running on which node in swarm?
for ITR in $(docker stack ps dockerstack --no-resolve --format '{{.Node}}={{.Image}}'); do echo -e "$(cut -d'=' -f2 <<< ${ITR})" - $(docker node inspect --format '{{.Status.Addr}}' "$(cut -d'=' -f1 <<< ${ITR})"); done
@kokigit
Copy link
Author

kokigit commented Oct 29, 2019

in the example docker stack name is "dockerstack"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment