demo01/compose-traefik.yml

59 lines
1.8 KiB
YAML
Raw Normal View History

2023-11-01 21:26:54 +08:00
version: '3.9'
name: traefik
services:
traefik:
image: traefik:latest
container_name: traefik01
hostname: traefik
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- y9-share-net
ports:
- "8081:8081"
- "8080:8080"
- "443:443"
volumes:
# Allows Traefik can listen to the Docker events
- "/var/run/docker.sock:/var/run/docker.sock"
# Mount the directory containing the certs
- "d:/docker-config/traefik/certs:/etc/certs/"
# Mount the dynamic configuration
- "d:/docker-config/traefik/dynamic/certs-traefik.yaml:/etc/traefik/dynamic/certs-traefik.yaml"
command:
- "--global.sendanonymoususage=false"
- "--global.checknewversion=false"
- "--api=true"
- "--api.dashboard=true"
- "--api.insecure=true"
- "--api.debug=false"
- "--ping=true"
- "--log.level=INFO"
- "--log.format=common"
- "--accesslog=false"
- "--entrypoints.web.address=:8081"
- "--entrypoints.web-ssl.address=:443"
- "--entrypoints.traefik.address=:8080"
- "--providers.docker=true"
- "--providers.docker.watch=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.endpoint=unix:///var/run/docker.sock"
- "--providers.docker.useBindPortIP=false"
- "--providers.docker.network=y9-share-net"
- "--providers.file=true"
- "--providers.file.watch=true"
- "--providers.file.directory=/etc/traefik/dynamic"
- "--providers.file.debugloggeneratedtemplate=true"
healthcheck:
test: ["CMD-SHELL", "wget -q --spider --proxy off localhost:8080/ping || exit 1"]
interval: 5s
retries: 10
logging:
driver: "json-file"
options:
max-size: "1m"
networks:
y9-share-net:
external: true