-
-
Notifications
You must be signed in to change notification settings - Fork 94
/
docker-compose-traefik.yml
50 lines (45 loc) · 1.59 KB
/
docker-compose-traefik.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
version: "3.3"
services:
traefik:
image: traefik:v2.11.10
container_name: traefik
command:
- --api.dashboard=true
- --providers.docker=true
- --accesslog=true
- --providers.docker.exposedbydefault=false
- --providers.docker.network=mynetwork
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --certificatesresolvers.le.acme.email=${LE_EMAIL}
- --certificatesresolvers.le.acme.storage=/letsencrypt/acme.json
- --certificatesresolvers.le.acme.httpChallenge.entrypoint=web
- --certificatesresolvers.le.acme.httpChallenge=true
- "--certificatesresolvers.le.acme.preferredChain=ISRG Root X1"
restart: unless-stopped
ports:
- 80:80
- 443:443
labels:
- traefik.enable=true
- traefik.http.routers.traefik.rule=Host(`${DOMAIN}`)
- traefik.http.routers.traefik.tls=true
- traefik.http.routers.traefik.tls.certresolver=le
- traefik.http.routers.traefik.service=api@internal
- traefik.http.services.api.loadbalancer.server.port=8080
- traefik.http.routers.traefik.tls.domains[0].main=${DOMAIN}
- traefik.http.routers.traefik.middlewares=frontend
- traefik.http.middlewares.frontend.basicAuth.users=${HASHED_ADMIN_USER_PASS}
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- traefik-le:/letsencrypt
networks:
- mynetwork
volumes:
traefik-le:
networks:
mynetwork:
external: true
# Generate HASHED_ADMIN_USER_PASS using below command
# htpasswd -B -C 10 -c .htpasswd user1
# cat .htpasswd | sed -e s/\\$/\\$\\$/g