2021-11-12 21:57:19 +00:00
|
|
|
|
|
|
|
```yaml
|
|
|
|
version: '3.7'
|
|
|
|
services:
|
|
|
|
traefik:
|
|
|
|
image: traefik:v2.2
|
|
|
|
container_name: traefik
|
|
|
|
volumes:
|
|
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
|
|
ports:
|
|
|
|
- 80:80
|
|
|
|
command:
|
|
|
|
- '--api'
|
|
|
|
- '--providers.docker=true'
|
|
|
|
- '--providers.docker.exposedByDefault=false'
|
2021-12-12 16:18:55 +00:00
|
|
|
- "--entrypoints.web.address=:80"
|
2021-11-12 21:57:19 +00:00
|
|
|
|
2021-12-12 16:18:55 +00:00
|
|
|
authentik-proxy:
|
2021-12-12 16:13:46 +00:00
|
|
|
image: goauthentik.io/proxy:latest
|
2021-11-12 21:57:19 +00:00
|
|
|
ports:
|
|
|
|
- 9000:9000
|
|
|
|
- 9443:9443
|
|
|
|
environment:
|
|
|
|
AUTHENTIK_HOST: https://your-authentik.tld
|
|
|
|
AUTHENTIK_INSECURE: "false"
|
|
|
|
AUTHENTIK_TOKEN: token-generated-by-authentik
|
|
|
|
# Starting with 2021.9, you can optionally set this too
|
|
|
|
# when authentik_host for internal communication doesn't match the public URL
|
|
|
|
# AUTHENTIK_HOST_BROWSER: https://external-domain.tld
|
|
|
|
labels:
|
|
|
|
traefik.enable: true
|
|
|
|
traefik.port: 9000
|
2021-11-26 12:29:38 +00:00
|
|
|
traefik.http.routers.authentik.rule: Host(`app.company`) && PathPrefix(`/akprox/`)
|
2021-12-12 16:18:55 +00:00
|
|
|
# `authentik-proxy` refers to the service name in the compose file.
|
|
|
|
traefik.http.middlewares.authentik.forwardauth.address: http://authentik-proxy:9000/akprox/auth/traefik
|
2021-11-12 21:57:19 +00:00
|
|
|
traefik.http.middlewares.authentik.forwardauth.trustForwardHeader: true
|
2021-12-20 20:37:22 +00:00
|
|
|
traefik.http.middlewares.authentik.forwardauth.authResponseHeadersRegex: ^(Auth|Remote|X).*$$
|
2021-11-12 21:57:19 +00:00
|
|
|
restart: unless-stopped
|
|
|
|
|
|
|
|
whoami:
|
|
|
|
image: containous/whoami
|
|
|
|
labels:
|
|
|
|
traefik.enable: true
|
2021-11-26 12:29:38 +00:00
|
|
|
traefik.http.routers.whoami.rule: Host(`app.company`)
|
2021-11-12 21:57:19 +00:00
|
|
|
traefik.http.routers.whoami.middlewares: authentik@docker
|
|
|
|
restart: unless-stopped
|
|
|
|
```
|