Tag Archives: docker

docker-compose notes

version: '3.8'

services:

  filebeat-app:
  image: docker.elastic.co/beats/filebeat:${ELK_VERSION}
  hostname: "{{.Service.Name}}-{{.Task.Slot}}"
    deploy:
      mode: global
      placement:
        max_replicas_per_node: 1
        constraints:
          - "node.labels.zoom-connector==true"

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