Docker
Thekey0ai/key0 image is published to Docker Hub on every release. It bundles the Key0 server, the setup UI, and a health check endpoint — everything you need to run Key0 without installing Node or Bun.
Image tags
| Tag | Description |
|---|---|
latest | Latest stable release. Safe for production. |
1.2.3 | Exact version pin. Immutable once published. |
1.2 | Latest patch within the 1.2.x line. |
1 | Latest minor and patch within the 1.x.x line. |
canary | Built from the main branch on every push. Use for testing only. |
Pin to a specific semver tag (e.g.
key0ai/key0:1.2.3) in production to avoid unexpected upgrades.Quick start
- docker run
- Docker Compose
Run Key0 with a single command. You provide your own Redis and Postgres URLs.The server starts on port 3000. If required configuration is missing, the server redirects to
/setup — a browser-based UI where you can configure your wallet address, pricing plans, storage, and other settings. Once saved, the server restarts automatically with your configuration applied. You can revisit /setup at any time to reconfigure.Compose profiles
Docker Compose profiles let you choose how much infrastructure Key0 manages for you.| Command | What starts | When to use |
|---|---|---|
docker compose up | Key0 only | You manage Redis and Postgres externally. Set REDIS_URL and DATABASE_URL in .env. |
docker compose --profile redis up | Key0 + Redis | You manage Postgres externally. Set DATABASE_URL in .env. |
docker compose --profile postgres up | Key0 + Postgres | You manage Redis externally. Set REDIS_URL in .env. |
docker compose --profile full up | Key0 + Redis + Postgres | Everything managed. No external dependencies needed. |
Managed infrastructure is auto-detected at startup via DNS resolution. The
KEY0_MANAGED_INFRA environment variable is optional and only needed as an explicit override.Compose file reference
The fulldocker-compose.yml ships in the docker/ directory of the repository.
docker-compose.yml
Services
| Service | Image | Purpose |
|---|---|---|
key0 | key0ai/key0:latest | Key0 server and setup UI. Listens on ${PORT:-3000}. |
redis | redis:7-alpine | Challenge store and seen-tx store. Activated by redis or full profile. |
postgres | postgres:16-alpine | Persistent storage and audit log. Activated by postgres or full profile. |
Volumes
| Volume | Mounted at | Purpose |
|---|---|---|
key0-config | /app/config | Persists .env.runtime (seller config written by the setup UI) across container restarts. |
redis-data | /data | Redis AOF/RDB persistence. |
postgres-data | /var/lib/postgresql/data | Postgres data directory. |
Environment variables
Pass environment variables via-e flags, an env_file, or shell exports that Docker Compose reads automatically.
| Variable | Default | Description |
|---|---|---|
PORT | 3000 | Port the Key0 server listens on. |
REDIS_URL | redis://redis:6379 | Redis connection string. Points to the managed Redis service by default. |
DATABASE_URL | postgresql://key0:key0@postgres:5432/key0 | Postgres connection string. Points to the managed Postgres service by default. |
POSTGRES_USER | key0 | Username for the managed Postgres instance. |
POSTGRES_PASSWORD | key0 | Password for the managed Postgres instance. |
POSTGRES_DB | key0 | Database name for the managed Postgres instance. |
KEY0_MANAGED_INFRA | (auto-detected) | Explicit override for managed infrastructure detection. Normally not needed. |
For the full list of Key0 application-level environment variables (wallet address, network, JWT secrets, etc.), see the Environment Variables page.
Health check
The Key0 container includes a built-in health check that pollsGET /health every 30 seconds.
Building from source
To build the image locally instead of pulling from Docker Hub:Networking tips
The Compose file mapshost.docker.internal to the host gateway. This lets the Key0 container reach services running on your host machine (e.g. a local Redis or Postgres instance) using host.docker.internal as the hostname.

