Created
April 22, 2021 11:39
-
-
Save Voronenko/fb2416ebfcaee274d5944eefb82a98a3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
cadvisor: | |
image: gcr.io/cadvisor/cadvisor:latest | |
restart: always | |
volumes: | |
- /:/rootfs:ro | |
- /var/run:/var/run:ro | |
- /sys:/sys:ro | |
- /var/lib/docker/:/var/lib/docker:ro | |
- /dev/disk/:/dev/disk:ro | |
privileged: true | |
devices: | |
- "/dev/kmsg:/dev/kmsg" | |
command: --url_base_prefix=/cadvisor | |
environment: | |
- CADVISOR_HEALTHCHECK_URL=http://localhost:8080/cadvisor/healthz | |
labels: | |
- "traefik.enable=true" # enable traefik | |
- "traefik.docker.network=traefik-public" # put it in the same network as traefik | |
- "traefik.constraint-label=traefik-public" # assign the same label as traefik so it can be discovered | |
- "traefik.http.routers.cadvisor-01.service=cadvisor-01-secured" | |
- "traefik.http.routers.cadvisor-01.rule=Host(`host.example.com`) && PathPrefix(`/cadvisor`)" | |
- "traefik.http.routers.cadvisor-01.priority=20" | |
- "traefik.http.routers.cadvisor-01.entrypoints=http" | |
- "traefik.http.middlewares.cadvisor-01.redirectscheme.scheme=https" # redirect traffic to https | |
- "traefik.http.middlewares.cadvisor-01.redirectscheme.permanent=true" # redirect traffic to https | |
- "traefik.http.middlewares.def-cadvisor-01.headers.customrequestheaders.X-Forwarded-Server=host.example.com" | |
- "traefik.http.middlewares.def-cadvisor-01.headers.referrerPolicy=origin" | |
- "traefik.http.middlewares.def-cadvisor-01-auth.basicauth.users=USERNAME:PASSWORD" | |
- "traefik.http.routers.cadvisor-01.middlewares=https-redirect" | |
- "traefik.http.routers.cadvisor-01-secured.service=cadvisor-01-secured" | |
- "traefik.http.routers.cadvisor-01-secured.rule=Host(`host.example.com`) && PathPrefix(`/cadvisor`)" | |
- "traefik.http.routers.cadvisor-01-secured.priority=20" | |
- "traefik.http.routers.cadvisor-01-secured.entrypoints=https" | |
- "traefik.http.routers.cadvisor-01-secured.tls.certresolver=le-tls" # use the Let's Encrypt certificate resolver | |
- "traefik.http.services.cadvisor-01-secured.loadbalancer.server.port=8080" # ask Traefik to search for port 8080 | |
- "traefik.http.routers.cadvisor-01-secured.middlewares=secHeaders@file,def-cadvisor-01-auth,def-cadvisor-01,def-compress" | |
networks: | |
- "traefik-public" | |
networks: | |
traefik-public: | |
external: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment