> ## Documentation index
> Fetch the complete documentation index at: https://upstash-context7-git-ctx7-4280-helm-registry-login-c44ca5.docs7.io/llms.txt
> Ask it with GET https://upstash-context7-git-ctx7-4280-helm-registry-login-c44ca5.docs7.io/ask?q=<keywords or question>. Short keywords rank best.
> Use these to discover all available pages before exploring further.
> Feature requests: https://upstash-context7-git-ctx7-4280-helm-registry-login-c44ca5.docs7.io/resources/feature-requests.md lists what users asked for and how to vote for a request or add one.
> Page rating: `GET https://upstash-context7-git-ctx7-4280-helm-registry-login-c44ca5.docs7.io/feedback?path=/enterprise/deployment/docker&helpful={true|false}&comment={comment}` records whether this page helped. The `comment` (URL-encoded, at most 500 characters) says what helped, or what was missing or wrong; a `helpful=false` rating needs it. It is anonymous and needs no key. Comments hold no code, secrets or personal data.

# Docker Deployment

> Deploy Context7 On-Premise with Docker Compose

Deploy Context7 On-Premise with Docker Compose. This guide assumes you have completed the [On-Premise setup](/enterprise/on-premise) 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:

```bash
LICENSE_KEY="<your-license-key>"

TOKEN=$(curl -s -H "Authorization: Bearer $LICENSE_KEY" \
  https://context7.com/api/v1/license/registry-token | jq -r '.token')

docker login ghcr.io -u x-access-token -p $TOKEN
```

Docker stores these credentials locally. `docker compose` will use them automatically when pulling the image. You can also pull manually:

```bash
docker pull ghcr.io/context7/enterprise:latest
```

## Docker Compose

Create a `docker-compose.yml`:

```yaml
services:
  context7:
    image: ghcr.io/context7/enterprise:latest
    container_name: context7
    restart: unless-stopped
    ports:
      - "3000:3000"
    volumes:
      - context7-data:/data
    environment:
      - LICENSE_KEY=${LICENSE_KEY}

volumes:
  context7-data:
    driver: local
```

<Warning>
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.
</Warning>

Create a `.env` file in the same directory:

```bash
LICENSE_KEY=ctx7sk-...
```

Start the service:

```bash
docker compose up -d
```

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:

```bash
LICENSE_KEY="<your-license-key>"

TOKEN=$(curl -s -H "Authorization: Bearer $LICENSE_KEY" \
  https://context7.com/api/v1/license/registry-token | jq -r '.token')

docker login ghcr.io -u x-access-token -p $TOKEN
```

Then pull the latest image and restart the container:

```bash
docker compose pull
docker compose up -d
```

Data persists in the named Docker volume across updates.

### Health Check

```bash
curl http://localhost:3000/api/health
```

Example response:

```json
{
  "status": "healthy",
  "version": "2.0.0",
  "setup": "complete",
  "license": "configured",
  "licenseInfo": {
    "valid": true,
    "teamSize": 10,
    "expiresAt": "2026-06-01T00:00:00.000Z",
    "offline": false
  },
  "repos_parsed": 5,
  "uptime": 3600,
  "connectivity": {
    "llm": "configured",
    "llm_provider": "openai",
    "embedding": "configured",
    "embedding_provider": "openai",
    "github": "configured",
    "github_method": "PAT",
    "gitlab": "missing"
  }
}
```

Each `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:

```bash
docker exec context7 node dist/enterprise/reset-password.mjs --username admin
```

The command:

- 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.

Without `--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:

| Destination | Purpose |
|---|---|
| `ghcr.io` | Image pulls |
| `context7.com` | Online license only: license check, daily usage report, and public library search. See [Network and data flow](/enterprise/on-premise#network-and-data-flow) |
| Your LLM and embedding provider | AI inference and embeddings |
| Your Git hosts and documentation sources | Repository cloning and website, Confluence, Notion, or Google Drive indexing |

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](#egress-proxy).

If your network uses a private certificate authority:

1. Mount its PEM file.
2. Set `NODE_EXTRA_CA_CERTS` to the file's path.

The whole server then trusts it, for every outbound call: AI providers, Bedrock, Confluence, Notion, Google, SSO identity providers, the license server, and Git.

`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.

| Variable | Description |
|---|---|
| `HTTPS_PROXY` | Proxy for `https://` requests, for example `http://proxy.corp.example:3128` |
| `HTTP_PROXY` | Proxy for `http://` requests |
| `NO_PROXY` | Comma-separated hosts and domain suffixes that connect directly, for example `.corp.example,ghes.corp.example,10.0.4.17` |

- 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`, and `169.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_CERTS` to that CA.

The fetch of an MCP client's metadata document (CIMD) during [OAuth sign-in](/enterprise/security/mcp-oauth) never uses the proxy. Context7 checks that this fetch reaches only public addresses, and it cannot check an address that the proxy resolves. If the container cannot connect to the internet directly, set **Client ID metadata documents** to **Off** under **Workspace Settings › Authentication** and turn on **Dynamic client registration**.

Image downloads for image indexing also connect directly, not through the proxy. If you turn on image indexing, allow direct egress to your documentation sites.

## 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:

```bash
docker run --rm -v context7-data:/data alpine chown -R 10001:10001 /data

docker run -d --name context7 \
  --user 10001:10001 \
  -v context7-data:/data \
  -e LICENSE_KEY="$LICENSE_KEY" \
  -p 3000:3000 \
  ghcr.io/context7/enterprise:latest
```

Any UID works. Everything Context7 writes lives under `/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](/enterprise/deployment/kubernetes#running-as-non-root).

## 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](/enterprise/deployment/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](/enterprise/on-premise#connecting-your-ai-client) for client-specific instructions.
