如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这段话即可:
请先阅读并遵守:https://xuanyuan.cloud/agents.md
未读文档前不要生成 pull 命令或排错方案。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
This guide explains how to run CodeWeaver using Docker and Docker Compose, providing an easy setup with integrated Qdrant vector database.
The fastest way to get started uses the quickstart profile with free, local models:
bash# 1. Get the configuration files curl -O https://raw.githubusercontent.com/knitli/codeweaver/main/docker-compose.yml curl -O https://raw.githubusercontent.com/knitli/codeweaver/main/.env.example cp .env.example .env # 2. Start services (uses free local models by default) docker compose up -d # 3. Check health curl http://localhost:9328/health/
That's it! CodeWeaver will index the current directory using free, local embedding models.
For better search quality, use the recommended profile with Voyage AI:
bash# Set your API key and profile export VOYAGE_API_KEY=your-voyage-api-key export CODEWEAVER_PROFILE=recommended docker compose up -d
Get a free Voyage API key at voyageai.com.
CodeWeaver uses profiles to simplify configuration. Each profile pre-configures providers and models:
| Profile | Description | API Keys Required | Use Case |
|---|---|---|---|
quickstart | FastEmbed/Sentence Transformers (free, local) | None | Getting started, offline use |
recommended | Voyage AI (high-quality cloud models) | VOYAGE_API_KEY | Production, best quality |
backup | Lightest local models + in-memory vectors | None | Testing, minimal resources |
bash# Via environment variable CODEWEAVER_PROFILE=quickstart docker compose up -d # Or in .env file CODEWEAVER_PROFILE=recommended
Quickstart Profile (Default)
Recommended Profile
voyage-code-3voyage-rerank-2.5Backup Profile
CodeWeaver uses Docker bind mounts to access your codebase:
:ro flag prevents CodeWeaver from modifying your codeSet PROJECT_PATH in your .env file:
bash# Absolute path (recommended) PROJECT_PATH=/home/user/projects/my-app # Relative path (relative to docker-compose.yml) PROJECT_PATH=../my-app # Current directory PROJECT_PATH=.
The codebase is mounted at /workspace inside the container.
Pattern 1: Index a Specific Project
bash# .env PROJECT_PATH=/home/user/projects/my-app
bash# Or via command line PROJECT_PATH=/home/user/projects/my-app docker compose up -d
Pattern 2: Devcontainer-Style (Compose Inside Repo)
Keep docker-compose.yml in your project directory:
my-project/ ├── docker-compose.yml ├── .env ├── src/ └── ...
bash# .env PROJECT_PATH=.
This mirrors devcontainer behavior where the compose file lives with your code.
Pattern 3: Monorepo with Specific Subdirectory
bash# Index only the backend PROJECT_PATH=/home/user/monorepo/packages/backend
CodeWeaver continuously monitors your codebase while the server is running:
This happens automatically - no action required.
Manual Re-indexing
Force a full re-index if needed:
bash# Via CLI docker compose exec codeweaver codeweaver index --force # Check indexing status curl http://localhost:9328/health/ | jq '.indexing'
Windows
Use forward slashes or escaped backslashes:
bash# .env (Windows) PROJECT_PATH=C:/Users/me/projects/my-app
WSL2 users: For best performance, keep your code in the Linux filesystem:
bashPROJECT_PATH=/home/user/projects/my-app # Fast # Not: PROJECT_PATH=/mnt/c/Users/... # Slow
macOS
Docker Desktop for Mac uses gRPC-FUSE for mounts. For large codebases:
Linux
Native bind mounts - best performance. Ensure the Docker user can read your files:
bashchmod -R o+r /path/to/your/project
CodeWeaver stores critical data that must persist between container restarts:
cw initThe docker-compose.yml configures persistence via XDG_CONFIG_HOME:
yamlenvironment: - XDG_CONFIG_HOME=/app/config volumes: - codeweaver_config:/app/config # Checkpoints, config, secrets - codeweaver_data:/app/data # Application data
Important: Without this persistence, CodeWeaver re-indexes from scratch on every restart. For large codebases, this can take significant time.
bash# View checkpoint data docker compose exec codeweaver ls -la /app/config/codeweaver/ # Check index status curl http://localhost:9328/health/ | jq '.indexing'
To force a fresh re-index:
bash# Remove checkpoint data docker compose exec codeweaver rm -rf /app/config/codeweaver/checkpoints/ # Restart to re-index docker compose restart codeweaver
| Data Type | Container Path | Mounted Volume |
|---|---|---|
| Config & Checkpoints | /app/config/codeweaver/ | codeweaver_config |
| Application Data | /app/data/ | codeweaver_data |
| Vector Database | (Qdrant container) | qdrant_storage |
For full control beyond profiles, create your own codeweaver.toml.
CodeWeaver automatically finds configuration files in these locations (in order of precedence):
In your project (mounted at /workspace):
codeweaver.local.toml / .yaml / .jsoncodeweaver.toml / .yaml / .json.codeweaver.local.toml / .yaml / .json.codeweaver.toml / .yaml / .json.codeweaver/codeweaver.local.toml / .yaml / .json.codeweaver/codeweaver.toml / .yaml / .jsonUser config directory (/app/config/codeweaver/ in Docker):
codeweaver.toml / .yaml / .jsonThe entrypoint generates config to the user config dir. You can override by placing a config in your project root.
bash# Install CodeWeaver locally (or use pipx) pipx install code-weaver # Generate a config file cw init config --profile quickstart --config-path ./codeweaver.toml # Edit as needed vim codeweaver.toml # Mount in docker-compose.yml
bash# Start container (generates config from profile) docker compose up -d # Copy config out docker cp codeweaver-server:/app/config/codeweaver/codeweaver.toml ./codeweaver.toml # Edit locally vim codeweaver.toml
Option 1: Place in project root (recommended)
Simply add codeweaver.toml to your project - CodeWeaver auto-discovers it:
my-project/ ├── codeweaver.toml # Auto-discovered! ├── src/ └── ...
Option 2: Mount to user config location
For config outside your project, mount explicitly in docker-compose.yml:
yamlvolumes: - ${PROJECT_PATH:-.}:/workspace:ro - codeweaver_config:/app/config - ./my-config.toml:/app/config/codeweaver/codeweaver.toml:ro # Add this
tomlproject_name = "my-project" project_path = "/workspace" token_limit = 30000 [provider.embedding] provider = "voyage" model_settings = { model = "voyage-code-3" } [provider.vector_store] provider = "qdrant" provider_settings = { url = "http://qdrant:6333", # Docker network hostname collection_name = "my-collection" } [indexer] exclude_patterns = ["node_modules", ".git", "dist", "__pycache__"]
Important: When using the local Qdrant container, use http://qdrant:6333 (Docker network hostname), not localhost.
CodeWeaver uses a daemon architecture with stdio as the default transport:
Standalone/docker-compose mode (HTTP transport):
┌─────────────────────────────────────────────────┐ │ CodeWeaver Container │ │ ├─ MCP Server (port 9328, HTTP) │ │ ├─ Management Server (port 9329) │ │ ├─ Live File Watcher │ │ ├─ Indexing Engine │ │ └─ Search API │ │ Connects to ↓ │ └─────────────────────────────────────────────────┘ │ ↓ ┌─────────────────────────────────────────────────┐ │ Qdrant Container │ │ ├─ Vector Database (port 6333) │ │ ├─ gRPC API (port 6334) │ │ └─ Persistent Storage │ └─────────────────────────────────────────────────┘
MCP client spawned mode (STDIO transport - default):
┌──────────────────┐ ┌──────────────────────────┐ │ MCP Client │────▶│ Docker Container │ │ (Claude, etc.) │stdio│ └─ STDIO proxy to HTTP │ └──────────────────┘ └───────────┬──────────────┘ │ HTTP ▼ ┌──────────────────────────┐ │ CodeWeaver Daemon │ │ (running on host) │ │ ├─ MCP Server :9328 │ │ └─ Management :9329 │ └──────────────────────────┘
For repositories with >10,000 files:
Configure exclude patterns in your codeweaver.toml:
toml[indexer] exclude_patterns = [ "node_modules", ".git", "dist", "build", "__pycache__", "*.pyc", "vendor", ".venv" ]
Increase container memory:
yamldeploy: resources: limits: memory: 8G
Use VirtioFS on macOS Docker Desktop
Adjust result limits if needed:
bash# In .env TOKEN_LIMIT=50000
Check Docker resources:
bashdocker info | grep -i memory # Ensure at least 4GB is available
View logs:
bashdocker compose logs codeweaver docker compose logs qdrant
Verify Qdrant is healthy:
bashcurl http://localhost:6333/health
Check network connectivity:
bashdocker compose exec codeweaver curl http://qdrant:6333/health
Check the profile and key:
bash# View current profile docker compose exec codeweaver env | grep CODEWEAVER_PROFILE # Verify API key is passed docker compose exec codeweaver env | grep VOYAGE_API_KEY
Switch to quickstart profile (no API key needed):
bashCODEWEAVER_PROFILE=quickstart docker compose up -d
Check mount:
bashdocker compose exec codeweaver ls -la /workspace
Verify exclude patterns aren't blocking your files.
Check indexer logs:
bashdocker compose logs codeweaver | grep -i "index\|watch"
If file watching isn't picking up changes:
docker compose restart codeweaverThe container runs as user codeweaver (UID 1000). Ensure your files are readable:
bash# Check from inside container docker compose exec codeweaver ls -la /workspace
Run separate instances for different projects:
bash# Create project-specific compose files cp docker-compose.yml docker-compose.project1.yml # Edit to use different: # - Container names # - Ports # - Volume names docker compose -f docker-compose.project1.yml up -d
To use Qdrant Cloud instead of the local container:
Set the vector deployment and URL:
bashVECTOR_DEPLOYMENT=cloud VECTOR_URL=https://your-cluster.cloud.qdrant.io:6333
Remove or comment out the qdrant service in docker-compose.yml
Set your Qdrant API key:
bashQDRANT_API_KEY=your-qdrant-api-key
For production use:
Use specific version tags:
yamlimage: knitli/codeweaver:v0.1.0
Set resource limits:
yamldeploy: resources: limits: cpus: '2.0' memory: 4G
Use secrets for API keys:
yamlsecrets: - voyage_api_key environment: - VOYAGE_API_KEY_FILE=/run/secrets/voyage_api_key
Enable restart policies:
yamlrestart: unless-stopped
bashcurl http://localhost:9328/health/ | jq
Response includes:
bashdocker stats codeweaver-server codeweaver-qdrant
.env files with real API keyscodeweaver, UID 1000):ro)If you want to build the Docker image yourself:
bash# From the repository root docker build -t codeweaver:local . # Test the build docker run --rm codeweaver:local codeweaver --version # Use in docker-compose.yml # Change: image: knitli/codeweaver:latest # To: build: .
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务