Blog / Tutorials / Self-Host Authentik with Docker Compose on a VPS
(last updated: )

Self-Host Authentik with Docker Compose on a VPS

Authentik is an open-source identity provider that gives your self-hosted apps one login through OIDC, SAML, LDAP or a proxy outpost. You can run it from a single Docker Compose file on a small VPS with 2 CPU cores and 2 GB of RAM. This…

8 min read
Authentik gateway on a VPS connects to web apps through OIDC and SAML

Authentik is an open-source identity provider that gives your self-hosted apps one login through OIDC, SAML, LDAP or a proxy outpost. You can run it from a single Docker Compose file on a small VPS with 2 CPU cores and 2 GB of RAM. This guide covers the install, a reverse proxy, a first SSO application and the upkeep.

What Is Authentik?

Authentik sits in front of your apps and handles the login for them. Users sign in once, and Authentik tells Immich, Forgejo or Grafana who they are. It speaks OIDC and SAML for apps with SSO support, LDAP for older software, and it can put a login screen in front of apps that have no auth at all through a proxy outpost.

The project has been around since 2018 and is MIT-licensed at its core. It’s a heavier piece of software than a forward-auth portal like Authelia, but you get a full admin UI, flows you can edit, and a user directory. If you’re still choosing between tools, our comparison of the three main self-hosted SSO options is the place to start.

Authentik Install: Prerequisites and VPS Sizing

The official docs ask for at least 2 CPU cores and 2 GB of RAM, plus Docker with Compose v2 (or Podman). That’s the floor, and it’s tight. Third-party write-ups put a running install somewhere around 0.8 to 1.2 GB of RAM at idle, and the PostgreSQL container grows as you add users and events. I’d start with 4 GB if the box runs anything else.

You also need a domain pointing at the server, ports 80 and 443 open, and a few minutes to read the release notes. Authentik changes its stack between versions. The current compose file runs three containers (PostgreSQL, the server and the worker), and older guides that mention Redis are out of date.

Authentik VPS sizing by use case Indicative sizing based on Authentik’s documented minimum (2 CPU cores, 2 GB RAM) and third-party idle figures, as of December 2026. Measure on your own workload.
Use caseSuggested Contabo VPSWhy
Testing or a homelab with under 10 usersCore VPS with 8 GB RAMThe 2 GB minimum leaves little headroom once Docker and a few other containers share the box.
Small team with 5 to 15 apps behind SSOCore VPS with 24 GB RAMRAM per euro is the Core line’s strength, and you can run the apps on the same server.
Team that logs in all day and values fast page loadsPerformance VPS (Cloud VPS Plus 8: 8 vCPU, 24 GB RAM, 450 GB NVMe)NVMe storage helps PostgreSQL when the event log grows.

Authentik Docker Compose Setup

The whole install is five commands. Run them as a normal user in an empty directory, for example /opt/authentik.

  1. Download the official compose file from the Authentik docs.
  2. Generate a database password and a secret key with openssl and write both into a .env file.
  3. Pull the images.
  4. Start the stack in the background.
  5. Open the initial setup page and set a password for the akadmin user.
mkdir -p /opt/authentik && cd /opt/authentik
wget https://docs.goauthentik.io/compose.yml -O docker-compose.yml

echo "PG_PASS=$(openssl rand -base64 36 | tr -d '\n')" >> .env
echo "AUTHENTIK_SECRET_KEY=$(openssl rand -base64 60 | tr -d '\n')" >> .env

docker compose pull
docker compose up -d
docker compose ps

Authentik listens on port 9000 (HTTP) and 9443 (HTTPS) by default. Open http://your-server-ip:9000/if/flow/initial-setup/ and create the admin account. Don’t skip that step, because anyone who finds the URL first can claim the account.

Two gotchas from the docs are worth knowing. Don’t mount /etc/timezone or /etc/localtime into the containers, because that breaks the date handling. And the worker container mounts the Docker socket so it can manage outposts, which means you should treat that container as sensitive.

Put Authentik Behind a Reverse Proxy with SSL

Port 9000 over plain HTTP isn’t something to leave open. Put a reverse proxy in front, get a Let’s Encrypt certificate and close 9000 and 9443 to the outside. Any proxy works if it forwards WebSocket traffic.

If you want a point-and-click setup, our Nginx Proxy Manager guide for Docker on a VPS covers certificates and proxy hosts. Coolify and Dokploy bundle their own proxy, and our Coolify vs Dokploy comparison helps you pick between them.

Authentik SSO: Protect Your First Application

Immich makes a good first target because it supports OIDC natively. The steps are the same for most apps.

  1. In the Authentik admin interface, go to Applications and create a new application with an OAuth2/OpenID provider.
  2. Copy the client ID and client secret Authentik generates.
  3. Add the redirect URIs from the app’s own OAuth docs. For Immich that’s the mobile and web callback URLs.
  4. In the app, open its OAuth settings, paste the issuer URL (https://auth.example.com/application/o/your-app-slug/), the client ID and the secret.
  5. Log out, then sign in with the new SSO button and confirm the account is created.

Test in a private window before you disable password login. Locking yourself out of Immich because a redirect URI had a typo is annoying but fixable if you kept an admin password. Our Immich install guide covers the app side if you haven’t set it up yet.

For apps with no SSO support, use a proxy outpost instead. Authentik checks the session and forwards the request only for logged-in users. It works, but the app still has its own login behind it unless you pass headers through.

Self-Hosted SSO: Backups, Updates and Hardening

An identity provider is a single point of failure. If it goes down or loses its database, nobody can log in anywhere, so the upkeep matters more than for a bookmark manager.

  • Back up PostgreSQL with a nightly pg_dump or a volume snapshot, and keep one copy off the server.
  • Pin the image version in .env instead of floating on the latest tag, then read the release notes before each upgrade.
  • Turn on MFA for every admin account and keep one recovery path, such as a stored recovery code.
  • Keep the akadmin account for emergencies and give daily admin work to a named user.
  • Limit who can reach the admin interface with a firewall rule or an IP allow list.

For the server itself, our VPS security checklist covers SSH keys, updates and firewall basics. Do those first.

Upgrades deserve a dry run. Authentik ships a new minor release every few months, and some of them change the compose file or drop a service. Take a database dump, read the release notes, then pull the new images and watch the worker logs for the first 10 minutes. If something breaks, you restore the dump and go back to the pinned tag. That whole routine takes about 20 minutes, and it’s far less work than rebuilding every application link from scratch after a bad upgrade.

Why Run Authentik on a Contabo Performance VPS

Authentik is a RAM-hungry app compared with a lightweight portal, and the apps behind it want memory too. A Performance VPS (Cloud VPS Plus 8) gives you 8 vCPU on AMD EPYC, 24 GB of RAM and 450 GB of NVMe at 28.00 EUR a month excluding VAT for the first 24 months, as of December 2026. That’s enough for Authentik, PostgreSQL and a dozen apps on one machine.

If you only run a handful of services, a Core VPS costs less and still gives you the RAM. Start small, watch memory with docker stats for a week, and move up if the numbers say so.

FAQ: Authentik

Is Authentik free and open source?

Yes, the core of Authentik is open source under the MIT license and free to self-host. The company behind it also sells an enterprise edition with extra features and support, but the open-source version covers SSO, MFA, flows and outposts for most self-hosters.

How much RAM does Authentik need?

The official docs list 2 CPU cores and 2 GB of RAM as the minimum. Real installs usually idle at about 1 GB, so 4 GB gives you room for PostgreSQL and a few other containers, and 8 GB or more is comfortable on a shared server.

Can Authentik provide SSO for apps that have no SSO support?

Yes, through a proxy outpost. Authentik checks the user’s session and only forwards the request if they’re logged in. The app may still show its own login page, unless you pass authentication headers through, which not every app accepts.

Is a self-hosted SSO worth it for a small team?

It depends on how many apps you run. With three or more services and several users, one login and one MFA setup save time. With one or two apps, the extra server to maintain probably isn’t worth it, and each app’s built-in login is enough.

Disclaimer: Product specifications, features, and prices mentioned in this article are subject to change and may vary by region, billing term, and active promotions. Please check each provider’s or brand’s official website for current figures, pricing, and local currency rates.