How to Install Pocket ID on VPS with Docker: Passkey Login Without Passwords
Passwords are the weakest part of a self-hosted setup. One password gets reused across five services, one breach somewhere else puts all of them at risk, and a password reset always arrives at the worst moment. The hardware key or fingerprint reader on your phone is stronger: that credential cannot be copied off a server, cannot be guessed, and cannot be phished through a fake login page in the same way.
Pocket ID turns passkeys into the login gateway for all your services. It is a lightweight OpenID Connect (OIDC) provider, built for small teams and homelabs that find Keycloak too large for what they need. Users sign in once with a passkey, and every connected app recognizes them. This guide installs Pocket ID as a single Docker container, finishes the admin setup, and registers the first OIDC client.
One thing to understand before starting: passkeys are bound to a domain. The address you set at the start is the address passkeys recognize, so settle on the final domain now, publish it over HTTPS, and do not change it later without a plan. Changing the domain means old passkeys no longer match the new address.
Before you start: what you need
- A VPS with Docker and Docker Compose v2 already installed.
- A domain whose
Arecord already points at the VPS public IP, for exampleid.example.com. Pocket ID must be reached over HTTPS, because browsers only allow passkey creation in a secure context. - A reverse proxy already running that can forward that domain to the container, such as Nginx Proxy Manager from an earlier Rnevio guide. Pocket ID itself serves HTTP on its internal port; TLS is handled by the proxy in front of it.
- A passkey-capable device: a phone with a fingerprint reader or face scan, a security key such as a YubiKey, or a password manager that supports passkeys.
- Port
1411free on the server for the Pocket ID container.
Check Docker and Compose:
docker --version
docker compose version
Expected result: both commands print a version number with no error.
Step 1: create the encryption key and the .env file
Pocket ID requires exactly one secret variable: ENCRYPTION_KEY, which encrypts sensitive data such as the token signing keys. The key must be at least 16 bytes, and the official documentation suggests a random 32-character string. First create the project folder and the key:
mkdir -p ~/pocket-id
cd ~/pocket-id
openssl rand -base64 32
The last command prints one random string. Copy it, then create a .env file with a text editor, for example nano .env, and fill it with your own values:
APP_URL=https://id.example.com
ENCRYPTION_KEY=paste-the-openssl-random-string-here
TRUST_PROXY=true
What each line does: APP_URL is the address users open in the browser, with no path after it, and it must match your public address exactly; ENCRYPTION_KEY is the key from the command above; and TRUST_PROXY=true tells Pocket ID it sits behind a reverse proxy, so the client IP is read from the headers the proxy forwards. The value true trusts every address, so use it only when Pocket ID genuinely cannot be reached except through your proxy.
Replace id.example.com with your domain. Treat this .env file like a password: anyone holding the encryption key plus a copy of the data folder can open the installation's sensitive data.
Step 2: create the Compose file and start Pocket ID
Still in ~/pocket-id, create docker-compose.yml with a text editor and fill it with the following configuration. The image, port, and volume follow Pocket ID's official documentation:
services:
pocket-id:
image: ghcr.io/pocket-id/pocket-id:v2
restart: unless-stopped
env_file: .env
ports:
- '127.0.0.1:1411:1411'
volumes:
- ./data:/app/data
What each part does: the image ghcr.io/pocket-id/pocket-id:v2 is Pocket ID's official image; env_file: .env loads the three variables from the previous step; port 1411 is Pocket ID's built-in port; the mapping 127.0.0.1:1411:1411 makes the container answer only on the server itself, so the reverse proxy is the only way in from the internet; and the volume ./data:/app/data holds the whole installation's data, including the built-in SQLite database, uploads, and the GeoLite database, so data survives recreating the container.
Start the stack in the background:
docker compose up -d
docker compose ps
docker compose logs -f pocket-id
Expected result: the pocket-id container shows as running, and the logs show the service starting to listen on port 1411. Press Ctrl+C to leave the log view.
Step 3: point the domain and finish the admin setup
In your reverse proxy, create a proxy host for id.example.com forwarding to 127.0.0.1:1411 on the VPS, with an active HTTPS certificate. If you use Nginx Proxy Manager, this is the same as creating an ordinary proxy host: domain, http scheme, forward host 127.0.0.1, port 1411, and a certificate from the SSL tab.
As soon as the domain opens, visit the first-run setup page right away:
https://id.example.com/setup
This page is only available before the first admin account exists, and whoever opens it first can become the admin. Do not leave this step until after the domain is public. Enter the admin username and email address, then follow the browser prompt to register your first passkey, whether through a fingerprint, a face scan, a security key, or a password manager.
The diagram above sums up the flow: a user opens an app, the app sends the browser to Pocket ID, the user unlocks with a passkey, and the app receives a token and creates its own session. No password is typed, sent, or stored anywhere along the way.
Once setup is done, the /setup page can no longer be used by someone else to claim your installation. Register a second passkey on a different device right away, such as a phone and a spare security key, before you actually need it. An account with no password means a spare passkey is the only way back if the main device is lost.
Step 4: register the first app as an OIDC client
Sign in to Pocket ID with your admin passkey, then register the app that should use this login:
- In the side menu, under Administration, click OIDC Clients.
- Click Add OIDC Client and enter a client name, for example your app's name.
- Fill in Callback URLs with the app's return address, the address the app uses after sign-in finishes. Take the exact value from the app's OIDC settings, because a single differing character makes sign-in fail at the last step.
- Save the client, then copy the Client ID and the secret created for it into the app's OIDC settings.
Expected result: the app shows a sign-in button through Pocket ID, and clicking it opens the Pocket ID sign-in page on your domain. After unlocking with a passkey, the browser returns to the app signed in, with no password exchanged at any point.
Common errors and how to fix them
| Symptom | Likely cause | Fix |
|---|---|---|
| Container restarts or stops at once | ENCRYPTION_KEY empty or too short | Make sure .env holds a key of at least 16 bytes from openssl rand -base64 32, then run docker compose up -d again |
| Setup page will not open | Reverse proxy not yet forwarding the domain to port 1411 | Check the proxy host points at 127.0.0.1:1411, and check docker compose ps and the container logs |
| Passkey fails to register or fails at sign-in | APP_URL does not exactly match the address in the browser | Match APP_URL to the public address, including the https scheme and no trailing slash; do not change it after passkeys exist |
| Sign-in from an app ends in an error | App callback URL not registered on the client | Copy the callback URL from the app's settings into the client's callback list without changing a single character |
/setup page no longer opens | First admin account already created | That is the expected behavior; sign in with the admin passkey and manage users from the admin panel |
| Data gone after moving folders | ./data volume not moved along or never backed up | Move the whole project folder including ./data, and back that folder up before updates or a server move |
Updating and backing up
Since all data lives in one volume, updating means pulling the newest image and recreating the container:
cd ~/pocket-id
docker compose pull
docker compose up -d
docker compose ps
Expected result: the container shows as running again, and all users and clients are still there. Before updating, back up the data folder, since that is where the installation's entire identity lives:
cp -r ~/pocket-id/data ~/pocket-id/data.backup
One last warning about the encryption key: do not change ENCRYPTION_KEY casually once the installation is running. Key rotation has its own procedure, which re-encrypts the data with the new key before the old one is replaced, and skipping that step damages data encrypted with the old key.
Summary
| Part | Value used |
|---|---|
| Image | ghcr.io/pocket-id/pocket-id:v2 |
| Internal port | 1411, bound to 127.0.0.1 |
| Data volume | ./data:/app/data |
| Required variable | ENCRYPTION_KEY (at least 16 bytes) |
| Public address | APP_URL=https://id.example.com |
| Behind a proxy | TRUST_PROXY=true |
| Admin setup | https://id.example.com/setup, first passkey |
| OIDC client | Client ID, secret, and registered callback URL |
Final checklist
- [ ] The
pocket-idcontainer shows asrunningindocker compose ps. - [ ] The domain
id.example.comopens over HTTPS and forwards to port1411. - [ ] The admin setup at
/setupis finished before anyone else opens it. - [ ] A spare passkey is registered on a second device.
- [ ] The first OIDC client is saved with an exact callback URL.
- [ ] The
./datafolder and the.envfile are backed up somewhere safe. - [ ]
APP_URLwill not change without a passkey migration plan.
Which app will you protect with passkeys first, and is your device ready to be its login key? Share it in the comments, since the answer decides whether you can register a client right away, or need to set up a spare passkey first.
Read also: the Rnevio article "How to Install Pangolin on a VPS with Docker: A Private Reverse Proxy with Login and Access Control" covers an access gateway in front of your services, while the paired guide in this batch is available at a Keycloak guide to one login for every application.


Diskusi
Ada pertanyaan atau pengalaman yang ingin dibagikan?
Komentar ditinjau sebelum ditampilkan. Mari berdiskusi dengan sopan dan sesuai topik.
Tulis komentar