1

I'd like to deploy cadvisor globally using Docker Swarm but would like to be able to access GUI per server.

I was thinking about using Traefik and was hoping to use {{.Node.Hostname}} option in Docker Compose.

  cadvisor:
    networks:
      - private
      - public
    command: -logtostderr -docker_only
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro
    deploy:
      restart_policy:
        condition: any
      mode: global
      labels:
      - traefik.enable=true
      - traefik.port=8080
      - traefik.docker.network=public
      - traefik.frontend.rule=Host:{{.Node.Hostname}}.example.com

Instead of seeing server-1.example.com, server-2.example.com, etc, it shows as {{.Node.Hostname}}.example.com.

Matt Fine
  • 11
  • 2

0 Answers0