|
| 1 | +# Docker-Based CTX |
| 2 | + |
| 3 | +CTX can be run in a Docker container, providing a consistent environment across different platforms and simplifying |
| 4 | +deployment. This guide covers how to configure and use CTX in a Docker container, including integration with Claude's |
| 5 | +MCP server. |
| 6 | + |
| 7 | +## Benefits of Docker-Based Deployment |
| 8 | + |
| 9 | +- **Cross-platform consistency**: Same behavior regardless of host OS |
| 10 | +- **Simplified deployment**: No need to install dependencies on host systems |
| 11 | +- **Multi-architecture support**: Works on both amd64 and arm64 architectures |
| 12 | +- **CI/CD integration**: Easy to incorporate into pipeline workflows |
| 13 | +- **Isolated environments**: Run different CTX versions side-by-side |
| 14 | +- **Container orchestration**: Integrates with Kubernetes, Docker Swarm, etc. |
| 15 | + |
| 16 | +## Using the Docker Image |
| 17 | + |
| 18 | +### Pull the Docker Image |
| 19 | + |
| 20 | +```bash |
| 21 | +docker pull ghcr.io/context-hub/ctx:latest |
| 22 | +``` |
| 23 | + |
| 24 | +### Run CTX Commands in Docker |
| 25 | + |
| 26 | +To run CTX commands in Docker, you need to mount your project directory as a volume: |
| 27 | + |
| 28 | +```bash |
| 29 | +docker run --rm -v /path/to/your/project:/workspace ghcr.io/context-hub/ctx:latest <command> <options> |
| 30 | +``` |
| 31 | + |
| 32 | +For example, to generate context in the current directory: |
| 33 | + |
| 34 | +```bash |
| 35 | +docker run --rm -v $(pwd):/workspace ghcr.io/context-hub/ctx:latest generate |
| 36 | +``` |
| 37 | + |
| 38 | +## Integrating with Claude's MCP Server |
| 39 | + |
| 40 | +To configure Claude's desktop app to use CTX in a Docker container as an MCP server, you'll need to modify the Claude |
| 41 | +desktop configuration. |
| 42 | + |
| 43 | +```json |
| 44 | +{ |
| 45 | + "mcpServers": { |
| 46 | + "ctx": { |
| 47 | + "command": "docker", |
| 48 | + "args": [ |
| 49 | + "run", |
| 50 | + "--rm", |
| 51 | + "-i", |
| 52 | + "-v", |
| 53 | + "/path/to/project:/workspace", |
| 54 | + "ghcr.io/context-hub/ctx:latest", |
| 55 | + "server", |
| 56 | + "-c", |
| 57 | + "/workspace" |
| 58 | + ] |
| 59 | + } |
| 60 | + } |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +#### Windows with WSL Configuration |
| 65 | + |
| 66 | +```json |
| 67 | +{ |
| 68 | + "mcpServers": { |
| 69 | + "ctx": { |
| 70 | + "command": "bash.exe", |
| 71 | + "args": [ |
| 72 | + "-c", |
| 73 | + "docker run --rm -i -v /path/to/project:/workspace ghcr.io/context-hub/ctx:latest server -c /workspace" |
| 74 | + ] |
| 75 | + } |
| 76 | + } |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | +## Docker Compose Example |
| 81 | + |
| 82 | +For more complex setups, you can use Docker Compose to manage your CTX deployment: |
| 83 | + |
| 84 | +```yaml |
| 85 | +# docker-compose.yml |
| 86 | +version: '3' |
| 87 | +services: |
| 88 | + ctx: |
| 89 | + image: ghcr.io/context-hub/ctx:latest |
| 90 | + volumes: |
| 91 | + - ./:/workspace |
| 92 | + environment: |
| 93 | + - GITHUB_PAT=${GITHUB_PAT} |
| 94 | + - MCP_FILE_OPERATIONS=true |
| 95 | + command: server -c /workspace |
| 96 | +``` |
0 commit comments