Prerequisites
- Docker and Docker Compose installed
- Context7 license key
Registry Authentication
Context7 Enterprise images are hosted onghcr.io and require authentication. Log in using your license key:
docker compose will use them automatically when pulling the image. You can also pull manually:
Docker Compose
Create adocker-compose.yml:
.env file in the same directory:
http://localhost:3000 in your browser to complete the setup wizard.
Operations
Updating
If your registry login has expired, re-authenticate first:Health Check
connectivity value is "configured" or "missing". github_method is "PAT", "GitHub App", or null.
/api/health is a liveness check. It still returns "healthy" when the database is down; repos_parsed and connectivity are then null.
To check that the instance can serve traffic, use GET /api/ready. It returns 200 when the database answers and the MCP bridge is up. Otherwise it returns 503.
Recover admin access
If you lose the admin password, or a broken SSO setup locks you out, reset a local admin account from inside the container:- Sets the password of the local account, and creates the account if it does not exist.
- Makes the account an enabled admin.
- Signs the account out of its sessions.
- Turns password sign-in back on.
--password <new>, it prints a generated password once. Passwords need at least 8 characters. The command does not work for a username that signs in with SSO.
Network Access
Context7 needs outbound HTTPS to these destinations:
An offline license (
ctx7off. prefix) is checked locally and makes no calls to context7.com. Per-user usage always stays on the instance.
To send these calls through an egress mirror, set CONTEXT7_API_URL (default https://context7.com/api).
To route this egress through a forward proxy, see Egress proxy.
If your network uses a private certificate authority:
- Mount its PEM file.
- Set
NODE_EXTRA_CA_CERTSto the file’s path.
GIT_TLS_INSECURE=true turns off TLS checks for all outbound HTTPS and Git calls. Use it only for testing.
Egress proxy
If the container reaches the internet only through an egress proxy, set the standard proxy variables. Context7 then sends all its outbound HTTP and HTTPS calls through the proxy: AI providers, Bedrock, Vertex AI, Git host APIs, Git clones over HTTPS, website crawling, connectors, and the license server.- Lower-case names (
https_proxy,http_proxy,no_proxy) also work. - Add your internal Git host, identity provider, and in-cluster services to
NO_PROXY. IP ranges in CIDR form (10.0.0.0/8) are not matched, so list each internal address or name. - Context7 always connects directly to
localhost, loopback addresses, and the cloud credential endpoints (169.254.169.254,metadata.google.internal,169.254.170.2, and169.254.170.23). You do not need to add them. - SSH Git clones do not use an HTTP proxy.
- If the proxy inspects TLS with its own certificate, also set
NODE_EXTRA_CA_CERTSto that CA.
Running as non-root
The container runs as root by default. To run it unprivileged, pass--user. If the volume already holds files written by a root container, or the UID you choose cannot write /data, chown the volume to that UID first:
/data, including source clones (/data/repos) and documentation-agent state (/data/home). The only other path it writes is /tmp.
A new volume starts with /data owned by UID 10001 and group 0 and group-writable, so UID 10001 or any UID in group 0 needs no chown. If the UID cannot write /data, the server exits at startup with the path it could not write. This requires image 1.3.2 or later. On Kubernetes, use fsGroup instead and the kubelet handles the ownership: see Kubernetes.
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 thepgvector 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.