Skip to content

Instantly share code, notes, and snippets.

@charly-vega
Created January 3, 2019 16:45
Show Gist options
  • Save charly-vega/5b0198bf4b3c4996a58f0db2684d236f to your computer and use it in GitHub Desktop.
Save charly-vega/5b0198bf4b3c4996a58f0db2684d236f to your computer and use it in GitHub Desktop.
docker node inspect $(docker node ls -q | xargs) | jq '[.[] | [.Spec.Role, "\(.Description.Hostname) - \(.ID)", .Spec.Labels, if .Description.Engine.Labels.frontend == "true" then { "frontend": true } else null end]] | group_by(.[0])'
curl -s $DOCKER_HOST/tasks | jq '[.[] | select(.DesiredState == "shutdown" and .Status.State == "running")] | sort_by(.NodeID) | .[] | [.NodeID, .ServiceID, .ID, .DesiredState, .Status.State] | @csv' -r
curl -s $DOCKER_HOST/tasks | jq '.[] | select(.NodeID == "jsr6wfrc43641huemibc1ea29") | [.NodeID, .ServiceID, .ID, .DesiredState, .Status.State] | @csv' -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment