Deploy Context7 On-Premise with Docker Compose. This guide assumes you have completed the On-Premise setup and have a valid license key.
Prerequisites
- Docker and Docker Compose installed
- Context7 license key
Registry Authentication
Context7 Enterprise images are hosted on ghcr.io and require authentication. Log in using your license key:
Docker stores these credentials locally. docker compose will use them automatically when pulling the image. You can also pull manually:
Docker Compose
Create a docker-compose.yml:
The context7-data volume is critical. It stores your SQLite database (configuration, credentials, indexed libraries) and all vector embeddings. Without a persistent volume, all data is lost when the container restarts or is recreated. Never run without a volume mount in production.
Create a .env file in the same directory:
Start the service:
Once the container is running, open http://localhost:3000 in your browser to complete the setup wizard.
Operations
Updating
If your registry login has expired, re-authenticate first:
Then pull the latest image and restart the container:
Data persists in the named Docker volume across updates.
Health Check
Example response:
Scaling
The setup above runs a single container with a local volume, which suits most deployments. To run multiple replicas behind a load balancer, move state to an external PostgreSQL (embeddings included, via the pgvector extension), so every replica is stateless and interchangeable. A turnkey multi-replica Compose file (app replicas + Nginx load balancer) ships in the deployment bundle.
See Scaling for the full setup, which also covers migrating an existing single-container deployment.
Connecting AI Clients
Once deployed, point your MCP clients to your deployment URL. See Connecting Your AI Client for client-specific instructions.