Authentik
Stack
Authentik is an open-source Identity Provider focused on flexibility and versatility
Services
postgresql
Configuration
Imagepostgres:12-alpine/var/lib/postgresql/data : databasePOSTGRES_PASSWORD=${PG_PASS:?database password required}POSTGRES_USER=${PG_USER:-authentik}POSTGRES_DB=${PG_DB:-authentik}unless-stoppedImage details
redis
Configuration
Imageredis:alpineunless-stoppedImage details
server
Configuration
Image${AUTHENTIK_IMAGE:-ghcr.io/goauthentik/server}:${AUTHENTIK_TAG:-2021.12.5}server0.0.0.0:${AUTHENTIK_PORT_HTTP:-9000}:90000.0.0.0:${AUTHENTIK_PORT_HTTPS:-9443}:9443/media : ./media/templates : ./custom-templates/geoip : geoipAUTHENTIK_REDIS__HOST=redisAUTHENTIK_POSTGRESQL__HOST=postgresqlAUTHENTIK_POSTGRESQL__USER=${PG_USER:-authentik}AUTHENTIK_POSTGRESQL__NAME=${PG_DB:-authentik}AUTHENTIK_POSTGRESQL__PASSWORD=${PG_PASS}unless-stoppedworker
Configuration
Image${AUTHENTIK_IMAGE:-ghcr.io/goauthentik/server}:${AUTHENTIK_TAG:-2021.12.5}worker/backups : ./backups/media : ./media/certs : ./certs/var/run/docker.sock : /var/run/docker.sock/templates : ./custom-templates/geoip : geoipAUTHENTIK_REDIS__HOST=redisAUTHENTIK_POSTGRESQL__HOST=postgresqlAUTHENTIK_POSTGRESQL__USER=${PG_USER:-authentik}AUTHENTIK_POSTGRESQL__NAME=${PG_DB:-authentik}AUTHENTIK_POSTGRESQL__PASSWORD=${PG_PASS}unless-stoppedgeoipupdate
Configuration
Imagemaxmindinc/geoipupdate:latest/usr/share/GeoIP : geoipGEOIPUPDATE_EDITION_IDS=GeoLite2-CityGEOIPUPDATE_FREQUENCY=8Image details
Standalone Install
Select an install method, to see config/commands for deploying Authentik
Install on Portainer
Import all app templates into your Portainer instance, for easy 1-click deploys
- Ensure both Docker and Portainer are installed, and up-to-date
- Log into your Portainer web UI
- Under Settings → App Templates, paste the below URL
- Head to Home → App Templates, and the list of apps will show up
- Select Authentik, fill in any config options, and hit Deploy
Template Import URL
https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me
Original stackfile
The compose file this template deploys, straight from its repo:
services:
postgresql:
image: postgres:12-alpine
restart: unless-stopped
volumes:
- database:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=${PG_PASS:?database password required}
- POSTGRES_USER=${PG_USER:-authentik}
- POSTGRES_DB=${PG_DB:-authentik}
env_file:
- .env
redis:
image: redis:alpine
restart: unless-stopped
server:
image: ${AUTHENTIK_IMAGE:-ghcr.io/goauthentik/server}:${AUTHENTIK_TAG:-2021.12.5}
restart: unless-stopped
command: server
environment:
AUTHENTIK_REDIS__HOST: redis
AUTHENTIK_POSTGRESQL__HOST: postgresql
AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik}
AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik}
AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
# AUTHENTIK_ERROR_REPORTING__ENABLED: "true"
# WORKERS: 2
volumes:
- ./media:/media
- ./custom-templates:/templates
- geoip:/geoip
env_file:
- .env
ports:
- "0.0.0.0:${AUTHENTIK_PORT_HTTP:-9000}:9000"
- "0.0.0.0:${AUTHENTIK_PORT_HTTPS:-9443}:9443"
worker:
image: ${AUTHENTIK_IMAGE:-ghcr.io/goauthentik/server}:${AUTHENTIK_TAG:-2021.12.5}
restart: unless-stopped
command: worker
environment:
AUTHENTIK_REDIS__HOST: redis
AUTHENTIK_POSTGRESQL__HOST: postgresql
AUTHENTIK_POSTGRESQL__USER: ${PG_USER:-authentik}
AUTHENTIK_POSTGRESQL__NAME: ${PG_DB:-authentik}
AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS}
# AUTHENTIK_ERROR_REPORTING__ENABLED: "true"
# This is optional, and can be removed. If you remove this, the following will happen
# - The permissions for the /backups and /media folders aren't fixed, so make sure they are 1000:1000
# - The docker socket can't be accessed anymore
user: root
volumes:
- ./backups:/backups
- ./media:/media
- ./certs:/certs
- /var/run/docker.sock:/var/run/docker.sock
- ./custom-templates:/templates
- geoip:/geoip
env_file:
- .env
geoipupdate:
image: "maxmindinc/geoipupdate:latest"
volumes:
- "geoip:/usr/share/GeoIP"
environment:
GEOIPUPDATE_EDITION_IDS: "GeoLite2-City"
GEOIPUPDATE_FREQUENCY: "8"
env_file:
- .env
volumes:
database:
driver: local
geoip:
driver: local
Or deploy it directly from the source:
git clone https://github.com/xneo1/portainer_templates
cd portainer_templates
docker compose -f Template/Stack/authentik.yml up -dMore install options in our documentation.
Container Documentation
postgresql Documentation
The PostgreSQL object-relational database system provides reliability and data integrity.
redis Documentation
Redis is the world’s fastest data platform for caching, vector search, and NoSQL databases.
geoipupdate Documentation
Use ghcr.io/maxmind/geoipupdate for new releases
Check the logs first
Nine times out of ten the logs tell you exactly what went wrong.
- In Portainer, go to Containers, click the container, then Logs. Or run
docker logs <container> - Exit codes help too:
137means killed, usually out of memory.126or127means the command inside the image is broken.
Can't reach the Docker socket
Authentik talks to Docker through /var/run/docker.sock. If the logs show
"permission denied while trying to connect to the Docker daemon socket", the app's user can't access it.
- Check the socket exists on the host:
ls -l /var/run/docker.sock - Run the container as root, or add the docker group's id to the container with
group_add.
Image won't pull
Test the pull directly on the host: docker pull postgres:12-alpine
- "manifest unknown" means the tag no longer exists.
- "toomanyrequests" is the Docker Hub rate limit. Log in with
docker loginto raise it. - "no space left on device" means a full disk. Reclaim space with
docker system prune
"exec format error"
This means the image was built for a different CPU architecture than your server.
- Check yours with
uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.
Container keeps restarting
The unless-stopped restart policy relaunches the app after every crash, so the real error can scroll past.
- Check the logs right after a restart, the last few lines before it died are the useful ones.
- Get the exit code with
docker inspect <container> --format '{{.State.ExitCode}}' - Still stuck? Redeploy once with the restart policy set to
noso the failure stays visible.
Stack won't deploy
Compose stacks fail fast on small mistakes, and Portainer shows the reason just above the editor.
- YAML only accepts spaces for indentation, a single tab breaks the whole file.
- Relative volume paths like
./mediaoften fail in Portainer because there's no working directory. Swap them for absolute paths.
Raise an issue
Found something which isn't working as it should? Here's how to report it.
- Bug within the app: Open an issue within Authentik's repo
- Template not working: Open an issue on xneo1/portainer_templates
- This website not working: Open an issue on lissy93/portainer-templates
A Compose stack
Authentik is a Compose stack, a set of containers (5 of them) defined in one file and brought up together by Portainer, then started and stopped as a single app.
The services
This stack is built from 5 containers that run side by side. Here's each one, with the image it runs and anything it waits for first:
postgresqlrunspostgres:12-alpineredisrunsredis:alpineserverrunsghcr.io/goauthentik/server:2021.12.5workerrunsghcr.io/goauthentik/server:2021.12.5geoipupdaterunsmaxmindinc/geoipupdate:latest
Volumes
A volume is where Authentik keeps its files so they survive an update or a restart. Without one, anything it saves would sit inside the container and vanish the moment it's recreated. This template mounts:
/var/lib/postgresql/datakept in thedatabasevolume Docker manages/mediafrom./mediaon the host/templatesfrom./custom-templateson the host/geoipkept in thegeoipvolume Docker manages/backupsfrom./backupson the host/certsfrom./certson the host/var/run/docker.sockfrom/var/run/docker.sockon the host (a socket it talks to, not storage)/usr/share/GeoIPkept in thegeoipvolume Docker manages
Environment variables
Environment variables are the settings you hand over when you deploy, things like a password or a timezone. Authentik takes 10 of them, and one needs a value before it'll start properly:
POSTGRES_PASSWORD, needs a valuePOSTGRES_USER, defaults toauthentikPOSTGRES_DB, defaults toauthentikAUTHENTIK_REDIS__HOST, defaults toredisAUTHENTIK_POSTGRESQL__HOST, defaults topostgresqlAUTHENTIK_POSTGRESQL__USER, defaults toauthentikAUTHENTIK_POSTGRESQL__NAME, defaults toauthentikAUTHENTIK_POSTGRESQL__PASSWORD, pulled from your own environmentGEOIPUPDATE_EDITION_IDS, defaults toGeoLite2-CityGEOIPUPDATE_FREQUENCY, defaults to8
Restart policy
The restart policy here is unless-stopped, so Docker restarts Authentik after a crash or reboot, but leaves it off when you stop it on purpose. You can change this on the deploy screen. The choices are no (never restart), on-failure (only after a crash), unless-stopped (restart unless you stop it), and always (bring it back no matter what).
Networking
Portainer puts these services on one shared private network, so they can find each other by name (like postgresql) while only the ports above are open to you.
Platform
The platform is linux, the kind of system the container is built to run on. Docker and Portainer handle this on a normal Linux server.
Portainer app templates
Zooming out, this whole page comes from a Portainer app template: a short recipe telling Portainer how to set Authentik up. Add the template list to Portainer once, then deploying Authentik is a click rather than a wall of config.