Tag Archives: swarm

docker helpful commands

Get subnet’s CIDR

docker network ls -q | xargs docker network inspect -f '[{{ .Name }}]: {{ .IPAM.Config }}'

Get labels from nodes in swarm cluster

# execute on manager
docker node ls -q | xargs docker node inspect -f '[{{ .ID }} {{ .Description.Hostname }}]: {{ .Spec.Labels }}'
# 
docker node ls -q | xargs docker node inspect \
  -f '{{ .ID }} [{{ .Description.Hostname }}]: {{ range $k, $v := .Spec.Labels }}{{ $k }}={{ $v }} {{end}}'

Continue reading