Deploy Dory with Docker
Docker is the most direct path for self-hosting Dory in a browser-accessible environment. The container listens on port 3000.
Minimal Command
docker run -d --name dory \
-p 3000:3000 \
-e DS_SECRET_KEY="$(openssl rand -base64 32 | tr -d '\n')" \
-e BETTER_AUTH_SECRET="$(openssl rand -hex 32)" \
-e BETTER_AUTH_URL="http://localhost:3000" \
-e NEXT_PUBLIC_REQUIRE_EMAIL_VERIFICATION=false \
-e DORY_INIT_USER_EMAIL=admin@getdory.dev \
-e DORY_INIT_USER_PASSWORD=admin \
dorylab/dory:latestOpen http://localhost:3000 and sign in with the initialized user.
Enable AI
Add AI environment variables when you want SQL generation, AI Chat, and result analysis:
-e DORY_AI_PROVIDER=openai \
-e DORY_AI_MODEL=gpt-4o-mini \
-e DORY_AI_API_KEY=your_api_key_here \
-e DORY_AI_URL=https://api.openai.com/v1 \Supported providers include openai, openai-compatible, anthropic, google, qwen, xai, and meta.
Use an .env File
docker run -d --name dory \
-p 3000:3000 \
--env-file .env \
dorylab/dory:latestPersist Data
Dory uses PGlite file storage by default for its own application data. In Docker, keep that file under /app/data and mount /app/data to persistent disk storage:
docker volume create dory-data
docker run -d --name dory \
-p 3000:3000 \
--env-file .env \
-e DB_TYPE=pglite \
-v dory-data:/app/data \
dorylab/dory:latestYou can also use a host directory:
mkdir -p /srv/dory/data
docker run -d --name dory \
-p 3000:3000 \
--env-file .env \
-e DB_TYPE=pglite \
-v /srv/dory/data:/app/data \
dorylab/dory:latestSQLite and DuckDB files also need to be mounted into the container if you want Dory to read them.
Use Postgres for Application Data
For production, you can store Dory application data in Postgres:
DB_TYPE=postgres
DATABASE_URL=postgres://dory:strong_password@postgres.example.com:5432/dory
POSTGRES_SSL=trueThen run the container with the same .env file:
docker run -d --name dory \
-p 3000:3000 \
--env-file .env \
dorylab/dory:latestReverse Proxy and HTTPS
Put Dory behind HTTPS for team deployments. Set BETTER_AUTH_URL to the public Dory URL and include that URL in TRUSTED_ORIGINS.
Upgrade Checklist
- Back up persistent data and
.env. - Pull the new image.
- Stop the old container.
- Start the new container with the same env file and volume.
- Verify login, connections, SQL Console, AI, and Saved Queries.
FAQ
Why do auth links use the wrong domain?
Check that BETTER_AUTH_URL exactly matches the public URL users open.
Why is AI unavailable?
Check DORY_AI_PROVIDER, DORY_AI_MODEL, DORY_AI_API_KEY, and DORY_AI_URL.
Why cannot Docker access local SQLite or DuckDB files?
The file must be mounted into the container. Use the path inside the container when creating the Dory connection.