Skip to content

Instantly share code, notes, and snippets.

@RanKey1496
Created March 7, 2019 00:22
Show Gist options
  • Save RanKey1496/252dafcbb69d344f70e8059444f46f9b to your computer and use it in GitHub Desktop.
Save RanKey1496/252dafcbb69d344f70e8059444f46f9b to your computer and use it in GitHub Desktop.
Docker swarm tricks
# error from daemon in stream: Error grabbing logs: rpc error: code = Unknown desc = warning: incomplete log stream. some logs could not be retrieved for the following reasons: node xxx is not available
docker swarm ca --rotate
# list docker swarm nodes with labels
docker node ls -q | xargs docker node inspect \
-f '{{ .ID }} [{{ .Description.Hostname }}]: {{ .Spec.Labels }}'
# list docker swarm nodes with IPs
for NODE in $(docker node ls --format '{{.Hostname}}'); \
do echo -e "${NODE} - $(docker node inspect --format '{{.Status.Addr}}' "${NODE}")"; done
# show task of a service
docker service ps {service_name}
# use a existing network
# In the stack.yml declare the existing network like this
networks:
example:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment