Quick start: Docker Compose
After this page you have Codex running on your machine and you are signed in as its first admin. It uses the published images and a standalone Compose file with the app, the worker and Postgres 18.
Start Codex
Section titled “Start Codex”-
Make a folder and download the two files into it.
Terminal curl -LO https://github.com/codexsuite/docs/raw/main/examples/quickstart/docker-compose.ymlcurl -L https://github.com/codexsuite/docs/raw/main/examples/quickstart/.env.example -o .envThe first file is the Compose file. The second becomes your
.env. -
Open
.envand set three values.POSTGRES_PASSWORDis the database password. Use letters and digits only, because it goes into a connection string.CODEX_ADMIN_EMAILis the email you will sign in with.CODEX_ADMIN_PASSWORDis your password. It needs at least 10 characters.
Compose refuses to start if any of the three is empty. A password under 10 characters makes the app stop at startup.
-
Start the stack.
Terminal docker compose up -dCompose pulls the images, starts Postgres, and then starts the app and the worker. The app applies the database migrations when it starts.
-
Check that the app is up.
Terminal curl http://localhost:8080/healthThe stack takes about 20 seconds to come up, so wait and run the command again if it fails at first. The answer is JSON with
statusset tookand aversionthat names the commit you are running. -
Open
http://localhost:8080and sign in with the email and password from.env.


Codex has no sign-up. The first start creates your admin from the two CODEX_ADMIN_ values, and you add everyone else from User management.
After you sign in, Codex opens the Library. A fresh install has no books, so your Library is empty. The picture below shows demo content.


Remove the admin values
Section titled “Remove the admin values”You only need the two admin values for the first start. When you have signed in, remove them.
- Delete the
CODEX_ADMIN_EMAILandCODEX_ADMIN_PASSWORDlines from thecodexservice indocker-compose.yml. Do this first. Compose stops with “Set CODEX_ADMIN_EMAIL in .env” if the file still names the variables and they are empty in.env. - Delete the same two lines from
.env. - Run
docker compose up -dagain. Compose recreates the app container without them.
Your admin stays. These variables never change a user who already has a password. After the first start, editing them in .env does not change your password.
If the sign-in fails
Section titled “If the sign-in fails”Codex gives one answer to every failed sign-in, whatever the cause.


The message is “Incorrect email or password, or the account is locked for now.” You see the same message before the first admin exists. With this Compose file that happens if you removed the two admin lines before the first start, because no admin was created. Put the lines back in the Compose file, set both values in .env, and run docker compose up -d again. Once an admin has a password, .env no longer sets it.
Ten wrong passwords in a row lock the account for 15 minutes.
The files
Section titled “The files”Download docker-compose.yml and .env.example with the commands in step 1. The two files below are the same ones, so what you read matches what you download.
docker-compose.yml
Section titled “docker-compose.yml”# Codex quick start. Run it with: docker compose up -d# Copy .env.example to .env and set the three required values first.services: codex: image: ${CODEX_IMAGE:-ghcr.io/codexsuite/codex:latest} restart: unless-stopped ports: - "8080:8080" depends_on: postgres: condition: service_healthy environment: - CODEX_DB_CONNECTION=Host=postgres;Port=5432;Database=codex;Username=postgres;Password=${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env} # The key ring that encrypts the AI keys users save. Keep this volume, because Codex cannot read those keys without it. - CODEX_DATA_PROTECTION_DIR=/data/keys # The app creates this admin on first boot. Remove both lines after you have signed in. - CODEX_ADMIN_EMAIL=${CODEX_ADMIN_EMAIL:?Set CODEX_ADMIN_EMAIL in .env} - CODEX_ADMIN_PASSWORD=${CODEX_ADMIN_PASSWORD:?Set CODEX_ADMIN_PASSWORD in .env} # The app keeps uploaded files, renditions and exports here. The worker shares this volume. - CODEX_BLOB_ROOT=/data/blobs volumes: - codex-blobs:/data/blobs - codex-keys:/data/keys
worker: image: ${CODEX_WORKER_IMAGE:-ghcr.io/codexsuite/codex-worker:latest} restart: unless-stopped depends_on: postgres: condition: service_healthy environment: - CODEX_DB_CONNECTION=Host=postgres;Port=5432;Database=codex;Username=postgres;Password=${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env} - CODEX_BLOB_ROOT=/data/blobs - CODEX_DATA_PROTECTION_DIR=/data/keys # The web service applies the database migrations. The worker only claims jobs. - CODEX_DB_MIGRATE=false # Claims render and export jobs and skips the services that only the web process runs. - CODEX_ROLE=worker - CODEX_EVENTS_LISTEN=false volumes: - codex-blobs:/data/blobs - codex-keys:/data/keys
postgres: image: postgres:18 restart: unless-stopped command: ["postgres", "-c", "timezone=UTC", "-c", "log_timezone=UTC"] environment: - TZ=UTC - POSTGRES_DB=codex - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env} ports: # This binds to loopback, so other machines cannot reach the database. - "127.0.0.1:5432:5432" volumes: # PostgreSQL 18 images keep the cluster under /var/lib/postgresql. - codex-pgdata:/var/lib/postgresql healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d codex"] interval: 5s timeout: 5s retries: 10
volumes: codex-pgdata: codex-blobs: codex-keys:# Copy this file to .env and fill in the three values. Keep .env out of version control.
# The database password. Use letters and digits only, because it goes into a connection string.POSTGRES_PASSWORD=
# The app creates this admin on first boot. The password needs at least 10 characters.CODEX_ADMIN_EMAIL=CODEX_ADMIN_PASSWORD=
# Optional. To pin the images for production, set these to a commit tag.# CODEX_IMAGE=ghcr.io/codexsuite/codex:latest# CODEX_WORKER_IMAGE=ghcr.io/codexsuite/codex-worker:latestThe Compose file reads the image names from CODEX_IMAGE and CODEX_WORKER_IMAGE and defaults both to latest. The images have only the latest tag and one tag per commit, so a production install pins a commit tag. See Install for production.
The app listens on port 8080 over plain HTTP on every network interface. Postgres listens on 127.0.0.1 only.