demo01/compose-traefik.yml

69 lines
2.2 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"
2023-11-06 14:13:35 +08:00
#- "www.dingzhaojun.top:127.0.0.1"
2023-11-01 21:26:54 +08:00
networks:
2023-11-02 11:16:55 +08:00
y9-share-net: {}
2023-11-06 14:13:35 +08:00
#mynet:
# ipv4_address: '192.168.31.250'
2023-11-01 21:26:54 +08:00
ports:
2023-11-02 11:16:55 +08:00
# Expose 8081
2023-11-01 21:26:54 +08:00
- "8081:8081"
2023-11-02 11:16:55 +08:00
# Expose 7443 for TLS
- "7443:7443"
# The Web UI (enabled by --api.insecure=true)
2023-11-01 21:26:54 +08:00
- "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
2023-11-02 11:16:55 +08:00
- "d:/docker-config/traefik/dynamic:/etc/traefik/dynamic"
2023-11-01 21:26:54 +08:00
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"
2023-11-02 11:16:55 +08:00
- "--entrypoints.web-ssl.address=:7443"
2023-11-01 21:26:54 +08:00
- "--entrypoints.traefik.address=:8080"
2023-11-06 14:13:35 +08:00
- "--entrypoints.web.http.redirections.entrypoint.to=web-ssl"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
2023-11-01 21:26:54 +08:00
- "--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:
2023-11-02 11:16:55 +08:00
external: true
mynet:
2023-11-01 21:26:54 +08:00
external: true