-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-traefik.yml
55 lines (52 loc) · 1.97 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
51
52
53
54
55
version: '3'
services:
example_app:
container_name: example_app
restart: always
build: .
networks:
- web
labels:
- "traefik.http.routers.example.rule=Host(`app.your.domain`)"
- "traefik.http.routers.example.entrypoints=websecure"
- "traefik.http.routers.example.service=example"
- "traefik.http.services.example.loadbalancer.server.port=5005"
- "traefik.docker.network=web"
- "traefik.http.routers.example.tls=true"
example_traefik:
container_name: "example_traefik"
image: "traefik:latest"
restart: always
command:
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=true"
- "--api.dashboard=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.myresolver.acme.caserver=https://acme-v01.api.letsencrypt.org/directory"
- "--certificatesresolvers.myresolver.acme.email=thomas.doyle9@mail.dcu.ie"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
networks:
- web
volumes:
- "./letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
labels:
# Dashboard
- "traefik.http.routers.traefik.rule=Host(`your.domain`)"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.tls=true"
- "traefik.http.routers.traefik.tls.certresolver=myresolver"
# global redirect to https
- "traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.http-catchall.entrypoints=web"
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https"
networks:
web:
external: true