demo01/compose-traefik.yml

74 lines
2.4 KiB
YAML

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"
#- "www.dingzhaojun.top:127.0.0.1"
networks:
y9-share-net: {}
#mynet:
# ipv4_address: '192.168.31.250'
ports:
# Expose 8081
- "8081:8081"
# Expose 7443 for TLS
- "7443:7443"
# The Web UI (enabled by --api.insecure=true)
- "8080:8080"
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:/etc/traefik/dynamic"
command:
- "--global.sendanonymoususage=false"
- "--global.checknewversion=false"
- "--api=true"
- "--api.dashboard=true"
- "--api.insecure=true"
- "--api.debug=false"
- "--ping=true"
- "--log.level=DEBUG"
- "--log.format=common"
- "--accesslog=false"
- "--entrypoints.web.address=:8081"
- "--entrypoints.web-ssl.address=:7443"
- "--entrypoints.traefik.address=:8080"
- "--entrypoints.web.http.redirections.entrypoint.to=web-ssl"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--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"
- "--providers.consulCatalog=true"
- "--providers.consulCatalog.endpoint.address=consul:8500"
- "--providers.consulCatalog.exposedByDefault=false"
- "--providers.consulCatalog.stale=false"
- "--providers.consulCatalog.prefix=traefik"
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
mynet:
external: true