Authelia with Docker Compose
Authelia is an open-source authentication and authorization server providing two-factor authentication and single sign-on (SSO) for your applications via a web portal. In the project's words: Authelia README on GitHub checked 2026-09-26
Runs on: amd64, arm64, arm/v7 from each image's registry manifest, checked 2026-09-26; a CPU counts only if every image has a build for it. Image by image
Add Authelia to the builder to use your own domain and combine it with other apps in one file.
What Authelia needs
Only figures Authelia's own documentation publishes, each linked to the page it is on. Where the project gives no number, this page does not invent one.
| Resource | Minimum | Recommended |
|---|---|---|
| RAM | Not published by the project | |
| CPU | Not published by the project | |
| Disk | Not published by the project | |
Which hardware Authelia has images for
Read from each image's manifest list in its registry (anonymous, read-only) when this page was built. An app counts for a CPU only if every one of its images lists it.
- x86-64 PC or NAS (
linux/amd64): every image has a build. - Raspberry Pi 4/5, 64-bit OS (
linux/arm64): every image has a build. - Raspberry Pi 3 or Zero 2 W, 32-bit OS (
linux/arm/v7): every image has a build.
| Service | Image | Platforms in the manifest | Digest | Registry | Checked |
|---|---|---|---|---|---|
authelia | docker.io/authelia/authelia:latest | amd64, arm/v7, arm64 | sha256:bd97cff4fcbf715b5ff1f9ae286afbe6033afce385302520b0368122d43a6f54 | registry-1.docker.io | 2026-09-26 |
docker-compose.yml
This is exactly what the builder writes for Authelia alone on example.org: the official definition with its published ports removed and Caddy added in front. The time zone is Etc/UTC here; the builder uses your browser's. Every ${VARIABLE} is defined in the .env below.
# docker-compose.yml built at dankhost.com for: Authelia
# Each app block is its official compose definition. Only the names were prefixed with
# the app slug (services, containers, volumes, bind folders, .env variables) so any set of
# apps can share one file; other differences are listed under "Changed:" in each block.
# Only Caddy publishes ports. Secrets live in .env next to this file.
services:
# ---- Caddy: the one reverse proxy, HTTPS certificates from Let's Encrypt ----
# Source: https://caddyserver.com/docs/running (checked 2026-09-23)
# Source: https://github.com/dani-garcia/vaultwarden/wiki/Using-Docker-Compose (checked 2026-09-23)
# Caddyfile goes in ./caddy/Caddyfile. Fixed address 172.30.0.2 so apps can trust it exactly.
caddy:
image: "caddy:2"
container_name: "caddy"
restart: "unless-stopped"
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- "./caddy:/etc/caddy"
- "caddy-data:/data"
- "caddy-config:/config"
networks:
proxy:
ipv4_address: "172.30.0.2"
# ---- Authelia (auth.example.org) ----
# Source: https://www.authelia.com/integration/deployment/docker/ (checked 2026-09-26)
# Source: https://www.authelia.com/integration/proxies/caddy/ (checked 2026-09-26)
# Source: https://www.authelia.com/integration/proxies/traefik/ (checked 2026-09-26)
# Source: https://www.authelia.com/configuration/methods/secrets/ (checked 2026-09-26)
# Source: https://www.authelia.com/reference/guides/passwords/ (checked 2026-09-26)
# Source: https://www.authelia.com/configuration/security/access-control/ (checked 2026-09-26)
# Source: https://www.authelia.com/configuration/notifications/file/ (checked 2026-09-26)
# Source: https://www.authelia.com/configuration/session/introduction/ (checked 2026-09-26)
# Source: https://www.authelia.com/configuration/storage/sqlite/ (checked 2026-09-26)
# Changed: The documented standalone examples publish no port either; Caddy reaches authelia:9091 on the proxy network, the address Authelia's proxy guides assume.
# The documented *_FILE environment variables and the secrets folder are left out: this file stores data in SQLite instead of PostgreSQL (so there is no database password), and the three remaining secrets (JWT, session, storage encryption key) are written into configuration.yml, generated in your browser.
# The config folder is ./config (the examples use ${PWD}/data/authelia/config); TZ is your time zone, as in the repository's lite bundle.
authelia:
image: "docker.io/authelia/authelia:latest"
container_name: "authelia"
restart: "unless-stopped"
environment:
TZ: "Etc/UTC"
volumes:
- "./authelia/config:/config"
networks:
proxy: {}
networks:
# Pinned so the trusted-proxy address given to each app (172.30.0.2) is exact.
# If "docker compose up" reports "Pool overlaps", change 172.30.0 here, in Caddy's
# ipv4_address and in every trusted-proxy value to a free 172.x.0 range.
proxy:
ipam:
config:
- subnet: "172.30.0.0/24"
ip_range: "172.30.0.128/25"
gateway: "172.30.0.1"
volumes:
caddy-data:
caddy-config:
Caddyfile save as caddy/Caddyfile
Caddy gets and renews the HTTPS certificate for auth.example.org by itself once the DNS record points at your server and ports 80 and 443 reach it.
# Caddyfile built at dankhost.com. Save it as ./caddy/Caddyfile next to docker-compose.yml.
# Caddy gets and renews a Let's Encrypt certificate for each name below by itself,
# once the DNS records point at this server and ports 80 and 443 reach it.
# Authelia
auth.example.org {
reverse_proxy authelia:9091
}
.env
Authelia needs no secret here; the builder adds nothing you have to fill in by hand.
# .env for Authelia, from dankhost.com/app/authelia/. Nothing here is secret. # Keep this file private (chmod 600). # None of the chosen apps needs a variable here.
The two files Authelia needs next to the compose file
The builder writes them with your domain and fills every secret with random letters and digits made in your browser (crypto.getRandomValues); nothing is sent anywhere. Below, each secret is a FILL-IN-… placeholder instead, because a secret printed on a public page is the same for everyone who copies it.
./authelia/config/configuration.yml chmod 600
# configuration.yml for Authelia, built at dankhost.com.
# Save it as ./authelia/config/configuration.yml and run: chmod 600 ./authelia/config/configuration.yml
# The three secrets below were generated in your browser with crypto.getRandomValues.
# Authelia's secrets page allows secrets in this file and recommends permissions 0600 for it.
server:
address: 'tcp://:9091'
log:
level: 'info'
identity_validation:
reset_password:
jwt_secret: 'FILL-IN-64-RANDOM-LETTERS-AND-DIGITS'
authentication_backend:
file:
path: '/config/users_database.yml'
access_control:
# one_factor: a password for every app behind Authelia. The Access Control page
# describes rules (per domain: bypass, one_factor, two_factor, deny); none are set here.
default_policy: 'one_factor'
session:
secret: 'FILL-IN-64-RANDOM-LETTERS-AND-DIGITS'
cookies:
- domain: 'example.org'
authelia_url: 'https://auth.example.org'
storage:
encryption_key: 'FILL-IN-64-RANDOM-LETTERS-AND-DIGITS'
local:
path: '/config/db.sqlite3'
notifier:
# No e-mail server: messages Authelia would send (password reset links, the codes
# that confirm a new second factor) are written to this file instead.
filesystem:
filename: '/config/notification.txt'
./authelia/config/users_database.yml chmod 600
# users_database.yml for Authelia, built at dankhost.com.
# Save it as ./authelia/config/users_database.yml. Authelia stores password hashes, not passwords.
# Before the first start:
# 1. On the server run (the password in it was generated in your browser):
# docker run --rm docker.io/authelia/authelia:latest authelia crypto hash generate argon2 --password 'FILL-IN-24-RANDOM-LETTERS-AND-DIGITS'
# 2. Replace REPLACE_WITH_THE_DIGEST below with everything after "Digest: " in its output.
# 3. Log in as admin with that password. Delete these comment lines once you have: Authelia
# rewrites this file when a password changes.
users:
admin:
disabled: false
displayname: 'Admin'
password: 'REPLACE_WITH_THE_DIGEST'
email: 'admin@example.org'
groups:
- 'admins'
Put Authelia in front of your other apps
Tick Authelia in the builder together with other apps and every one of them gets a login check: before the proxy passes a request on, it asks Authelia whether the visitor is logged in, and sends them to auth.your domain if not. Authelia's own address is left open, since that is where the login page is. Here is what the builder writes for Authelia with Nextcloud and Immich:
With Caddy: a forward_auth block in each app's site
# Caddyfile built at dankhost.com. Save it as ./caddy/Caddyfile next to docker-compose.yml.
# Caddy gets and renews a Let's Encrypt certificate for each name below by itself,
# once the DNS records point at this server and ports 80 and 443 reach it.
# Authelia
auth.example.org {
reverse_proxy authelia:9091
}
# Nextcloud
cloud.example.org {
redir /.well-known/carddav /remote.php/dav/ 301
redir /.well-known/caldav /remote.php/dav/ 301
# Log in through Authelia first (forward_auth as in its Caddy integration docs)
forward_auth authelia:9091 {
uri /api/authz/forward-auth
copy_headers Remote-User Remote-Groups Remote-Email Remote-Name
}
reverse_proxy nextcloud-app:80
}
# Immich
photos.example.org {
# Log in through Authelia first (forward_auth as in its Caddy integration docs)
forward_auth authelia:9091 {
uri /api/authz/forward-auth
copy_headers Remote-User Remote-Groups Remote-Email Remote-Name
}
reverse_proxy immich-server:2283
}
With Traefik: the authelia middleware on each app's router
traefik.http.middlewares.authelia.forwardAuth.address: "http://authelia:9091/api/authz/forward-auth" traefik.http.middlewares.authelia.forwardAuth.trustForwardHeader: "true" traefik.http.middlewares.authelia.forwardAuth.maxResponseBodySize: "8192" traefik.http.middlewares.authelia.forwardAuth.authResponseHeaders: "Remote-User,Remote-Groups,Remote-Email,Remote-Name" traefik.http.routers.nextcloud.middlewares: "authelia@docker,nextcloud-dav-redirect" traefik.http.routers.immich.middlewares: "authelia@docker"
Changes from the official file
Besides prefixing every service, container, volume, folder and variable with authelia (so any set of apps can share one file), these are all the differences from what the project documents:
- The documented standalone examples publish no port either; Caddy reaches authelia:9091 on the proxy network, the address Authelia's proxy guides assume.
- The documented *_FILE environment variables and the secrets folder are left out: this file stores data in SQLite instead of PostgreSQL (so there is no database password), and the three remaining secrets (JWT, session, storage encryption key) are written into configuration.yml, generated in your browser.
- The config folder is ./config (the examples use ${PWD}/data/authelia/config); TZ is your time zone, as in the repository's lite bundle.
Notes for Authelia behind the proxy
- Before the first start, save configuration.yml and users_database.yml (the two extra files the builder writes) in ./authelia/config/ and run chmod 600 on both.
- users_database.yml has one user, admin. Authelia keeps only password hashes, so run the docker command written at the top of that file and put the text after "Digest: " in place of REPLACE_WITH_THE_DIGEST. That command is the one in Authelia's passwords guide.
- Every app behind Authelia needs a password login (default_policy one_factor) and the file writes no access_control rules. Authelia's Access Control page describes rules that set a policy per domain; add any you want to configuration.yml yourself.
- No e-mail is set up: the filesystem notifier writes what Authelia would e-mail (password reset links, the one-time codes that confirm a second factor) to ./authelia/config/notification.txt.
- Phone and desktop apps that talk to their server without a browser (the Nextcloud, Jellyfin, Immich or Home Assistant apps, Bitwarden clients for Vaultwarden) cannot pass a web login page. Try each client you use after adding Authelia.
How to run it
- At your DNS provider, add an A record named
authon your domain pointing at the server's public IP address, and forward TCP 80, TCP 443 and UDP 443 to it. - Save
./authelia/config/configuration.ymland./authelia/config/users_database.ymlfrom the files above (or from the builder, with the secrets filled in) and runchmod 600on them. - Save the three files in one folder:
docker-compose.ymland.envside by side, the Caddyfile at./caddy/Caddyfile. Replaceexample.orgwith your domain in the Caddyfile, the compose file and the .env,configuration.yml,users_database.yml, or let the builder do it. - Nothing in
.envneeds filling in;chmod 600 .envall the same. - Start it:
docker compose up -d docker compose logs -f caddy # watch the certificate arrive
- Open the new address (
auth.plus your domain) in a browser and follow the notes above.
Back it up
Everything Authelia keeps is in its /config folder: configuration.yml and users_database.yml, and the SQLite database (storage.local.path) that holds each user's registered second factors and preferences, encrypted with storage.encryption_key.
Below is the BACKUP.md the builder writes next to the compose file above: which of its folders and volumes hold data, what to copy with which container stopped, and a restore check. Pick more apps in the builder and it covers them all in one file.
# BACKUP.md built at dankhost.com for: Authelia
What to copy from the docker-compose.yml built with this file, the database dump each project documents (rewritten for the service names in that file), what to copy with which container stopped, and how to check the result. Run every command in the folder that holds docker-compose.yml.
The folders are owned by the containers' users: put sudo in front of tar if it says "Permission denied". Named volumes live under /var/lib/docker/volumes, not next to the compose file, so they are copied through a throwaway ubuntu container (Docker's documented --volumes-from method). tar makes a full copy each run; for large folders an incremental tool (restic, borg, rsync) saves time and space.
Never run "docker compose down -v" on this file: it deletes the named volumes of every app in it.
## Before you start
BACKUP=/mnt/backup/selfhost # change this: a disk or machine other than this server's system disk
mkdir -p "$BACKUP"
## Every time: the three stack files
tar czf "$BACKUP/stack-files.tar.gz" docker-compose.yml .env caddy
.env holds the database passwords and secret keys the apps were set up with; keep this archive as private as the data.
## Caddy (the reverse proxy)
Caddy's docs: 'The data directory must not be treated as a cache.' It holds the TLS certificates and their private keys; without it Caddy has to ask Let's Encrypt for every certificate again.
- caddy-data (named volume, /data in caddy)
BACK UP: TLS certificates, private keys, OCSP staples.
- caddy-config (named volume, /config in caddy)
SKIP: the last active configuration, kept for 'caddy run --resume', which this setup does not use: it starts from the Caddyfile.
- ./caddy (/etc/caddy in caddy)
IN stack-files.tar.gz: the Caddyfile, copied with the stack files above.
Copy (Caddy keeps serving while you copy):
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu tar cvf /backup/caddy-data.tar /data
Restore check:
tar tf "$BACKUP/caddy-data.tar" > /dev/null && echo OK
docker run --rm --volumes-from caddy -v "$BACKUP":/backup ubuntu bash -c "cd /data && tar xvf /backup/caddy-data.tar --strip 1"
Sources:
- Caddy docs: Conventions, Data directory: https://caddyserver.com/docs/conventions#data-directory (checked 2026-09-24)
- Docker docs: Volumes, Back up, restore, or migrate data volumes: https://docs.docker.com/engine/storage/volumes/#back-up-restore-or-migrate-data-volumes (checked 2026-09-24)
## Authelia
Everything Authelia keeps is in its /config folder: configuration.yml and users_database.yml, and the SQLite database (storage.local.path) that holds each user's registered second factors and preferences, encrypted with storage.encryption_key.
What this compose mounts:
- ./authelia/config (/config in authelia)
BACK UP: configuration.yml (with the secrets), users_database.yml, db.sqlite3 and notification.txt.
1. Stop authelia. Stopping it keeps the SQLite database from changing mid-copy.
docker compose stop authelia
2. Copy while authelia is stopped:
tar czf "$BACKUP/authelia-config.tar.gz" ./authelia/config
3. Start it again:
docker compose start authelia
Restore check:
tar tzf "$BACKUP/authelia-config.tar.gz" > /dev/null && echo OK
Put a copy back (with authelia stopped):
tar xzf "$BACKUP/authelia-config.tar.gz" # recreates ./authelia/config; move the old folder aside first
Stop it, put ./authelia/config back, start it. The database can only be read with the same encryption_key, which is in the configuration.yml you restored.
Sources:
- Authelia docs: Storage, SQLite (storage.local.path): https://www.authelia.com/configuration/storage/sqlite/ (checked 2026-09-26)
- Docker docs: Volumes, Back up, restore, or migrate data volumes: https://docs.docker.com/engine/storage/volumes/#back-up-restore-or-migrate-data-volumes (checked 2026-09-26)
Sources
Every page below was fetched on the date shown.
- Authelia README on GitHub checked 2026-09-26 (what it does)
- Authelia docs: Docker deployment (image docker.io/authelia/authelia:latest, /config volume, standalone compose examples) checked 2026-09-26 (compose definition and proxy settings)
- Authelia docs: Caddy integration (forward_auth authelia:9091, uri /api/authz/forward-auth, copy_headers) checked 2026-09-26 (compose definition and proxy settings)
- Authelia docs: Traefik integration (ForwardAuth middleware labels, authelia@docker) checked 2026-09-26 (compose definition and proxy settings)
- Authelia docs: Secrets (secrets in the configuration file, permissions 0600) checked 2026-09-26 (compose definition and proxy settings)
- Authelia docs: Passwords (users file format, authelia crypto hash generate argon2) checked 2026-09-26 (compose definition and proxy settings)
- Authelia docs: Access Control (default_policy, rules per domain) checked 2026-09-26 (compose definition and proxy settings)
- Authelia docs: Notifications, File System (notifier.filesystem.filename) checked 2026-09-26 (compose definition and proxy settings)
- Authelia docs: Session (cookies: domain, authelia_url) checked 2026-09-26 (compose definition and proxy settings)
- Authelia docs: Storage, SQLite (storage.local.path) checked 2026-09-26 (compose definition and proxy settings, backup plan)
- Caddy docs: Keep Caddy running (Docker Compose section) checked 2026-09-23 (Caddy)
- Vaultwarden wiki: Caddy with HTTP challenge (uses the caddy:2 image) checked 2026-09-23 (Caddy)
- Docker docs: Volumes, Back up, restore, or migrate data volumes checked 2026-09-26 (backup plan)
- Caddy docs: Conventions, Data directory checked 2026-09-24 (backup plan)