Running CodeGraphContext via Docker is the easiest way to use the tool without setting up a Python environment. This guide covers everything from quick start commands to advanced database configurations.
Pull the latest image from Docker Hub:
docker pull codegraphcontext/codegraphcontext:latestIndex your current directory:
docker run --rm \
-v "$(pwd):/workspace" \
-v cgc-data:/home/cgc/.codegraphcontext \
codegraphcontext/codegraphcontext cgc index .Note: The -v cgc-data:/home/cgc/.codegraphcontext volume is crucial as it persists the graph database across runs.
For convenience, a helper script is included in the repository.
# Clone the repository
git clone https://github.com/CodeGraphContext/CodeGraphContext.git
cd CodeGraphContext
# Index a repo
./scripts/docker-run.sh index /path/to/my-repo
# Run an interactive shell
./scripts/docker-run.sh shell
# Start the visualization server
./scripts/docker-run.sh vizThe repository includes a production-ready docker-compose.yml with several profiles depending on your needs.
Runs CGC using the embedded FalkorDB Lite or KuzuDB backend.
# Index current directory
docker compose run --rm cgc index .
# Analyze callers
docker compose run --rm cgc analyze callers my_functionRuns CGC alongside a dedicated FalkorDB container. Recommended for large projects or ARM64 architectures where FalkorDB Lite might not be fully supported.
# Start FalkorDB in the background
docker compose --profile falkordb up -d
# Now run CGC commands (it will auto-detect the separate database container)
docker compose run --rm cgc index .Starts the Visualization UI server, allowing you to explore the graph in your browser.
# Start the viz server
docker compose --profile viz up -d
# Visit http://localhost:8080 in your browserIf you prefer Neo4j, this profile starts a local Neo4j 5.x container.
# Start Neo4j
docker compose --profile neo4j up -d
# The docker-compose.yml already configures CGC to connect to this Neo4j container.
docker compose run --rm cgc index .You can run CodeGraphContext as an MCP (Model Context Protocol) server inside Docker to connect it to AI assistants like Claude Desktop, Cursor, or Windsurf.
docker run -i --rm \
-v "/path/to/your/codebase:/workspace" \
-v cgc-data:/home/cgc/.codegraphcontext \
-e CGC_MODE=mcp \
codegraphcontext/codegraphcontextImportant Notes for MCP in Docker:
- You MUST use the
-i(interactive) flag to keepstdinopen for the JSON-RPC protocol. - Do NOT use the
-t(tty) flag, as it will corrupt the JSON output. - You must mount your local codebase to
/workspaceinside the container so the MCP server can read the files.
{
"mcpServers": {
"CodeGraphContext": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"/Users/myname/projects:/workspace",
"-v",
"cgc-data:/home/cgc/.codegraphcontext",
"-e",
"CGC_MODE=mcp",
"codegraphcontext/codegraphcontext:latest"
]
}
}
}| Volume Mount | Description |
|---|---|
-v "$(pwd):/workspace" |
Mounts your local code into the container so CGC can index it. |
-v cgc-data:/home/cgc/.codegraphcontext |
Persists the databases, configuration, and index state. |
Permissions: The Docker image runs as a non-root user cgc (UID 1000). Ensure the mounted cgc-data volume has correct permissions.
The codegraphcontext/codegraphcontext image is multi-architecture, supporting:
linux/amd64(Standard Intel/AMD x86_64 PCs & Servers)linux/arm64(Apple Silicon M1/M2/M3, AWS Graviton, Raspberry Pi)
Docker will automatically pull the correct variant for your architecture.
| Tag | Usage |
|---|---|
latest |
The most recent stable release. Recommended for most users. |
edge |
Built automatically from the main branch. Contains the latest features but may be unstable. |
0.4.19 |
Specific semantic version. |
Manifests are provided in the k8s/ directory for deploying to a Kubernetes cluster.
kubectl apply -f k8s/configmap.yaml
kubectl apply -f k8s/pvc.yaml
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yamlNote: You may need to adjust the PersistentVolumeClaim (pvc.yaml) storage class to match your cluster environment.