Skip to content

Instantly share code, notes, and snippets.

@mtbdeano
Last active October 21, 2016 19:20
Show Gist options
  • Save mtbdeano/3d6ea559aaa1497f85df4b55ab32d791 to your computer and use it in GitHub Desktop.
Save mtbdeano/3d6ea559aaa1497f85df4b55ab32d791 to your computer and use it in GitHub Desktop.
Handy Docker Swarm 1.12 commands!

Get a list of all services on your swarm and their associated published ports:

docker service inspect \
    --format="{{range .Spec.EndpointSpec.Ports}} {{$.Spec.Name}} on port {{.PublishedPort}} {{else}} {{$.Spec.Name}} exposes nothing {{end}}" \
    `docker service ls|awk '{print $2;}'|tail -n +2`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment