This guide explains how to build and run AgentCrew using Docker.
# Run with console interface (GUI is disabled by default in Docker)
docker run -it --rm \
-e ANTHROPIC_API_KEY="your_claude_api_key" \
-e OPENAI_API_KEY="your_openai_api_key" \
agentcrew chatNote: The Docker version of AgentCrew automatically runs in console mode as GUI dependencies (PySide6) are excluded for smaller image size and better compatibility. The chat command will default to console mode in the Docker environment.
# Run as A2A server
docker run -d \
--name agentcrew-server \
-p 41241:41241 \
-e ANTHROPIC_API_KEY="your_claude_api_key" \
daltonnyx/agentcrew a2a-server --host 0.0.0.0 --port 41241# Create a named volume for persistence
docker volume create agentcrew_data
# Run with persistent data
docker run -it --rm \
-v agentcrew_data:/home/agentcrew/.AgentCrew \
-e ANTHROPIC_API_KEY="your_api_key" \
daltonnyx/agentcrew chat --console# Create local config directory
mkdir -p ~/.agentcrew-docker
# Run with host directory mounting
docker run -it --rm \
-v ~/.agentcrew-docker:/home/agentcrew/.AgentCrew \
-e ANTHROPIC_API_KEY="your_api_key" \
daltonnyx/agentcrew chat --consoleCreate a custom agents.toml file:
[[agents]]
name = "researcher"
description = "AI Research Assistant"
system_prompt = """You are a research assistant specialized in finding and analyzing information.
Current date: {current_date}
"""
tools = ["memory", "web_search", "code_analysis"]
[[agents]]
name = "coder"
description = "AI Coding Assistant"
system_prompt = """You are a coding assistant specialized in software development.
Current date: {current_date}
"""
tools = ["memory", "clipboard", "code_analysis"]Mount it when running:
docker run -it --rm \
-v $(pwd)/agents.toml:/home/agentcrew/.AgentCrew/agents.toml:ro \
-e ANTHROPIC_API_KEY="your_api_key" \
daltonnyx/agentcrew chat --console --agent-config /home/agentcrew/.AgentCrew/agents.tomlCreate a config.json file:
{
"api_keys": {
"ANTHROPIC_API_KEY": "your_claude_api_key",
"OPENAI_API_KEY": "your_openai_api_key"
}
}Mount it when running:
docker run -it --rm \
-v $(pwd)/config.json:/home/agentcrew/.AgentCrew/config.json:ro \
daltonnyx/agentcrew chat --console# Console mode with specific provider
docker run -it --rm daltonnyx/agentcrew chat --console --provider openai
# With custom configurations
docker run -it --rm \
-v $(pwd)/custom_agents.toml:/home/agentcrew/.AgentCrew/agents.toml:ro \
daltonnyx/agentcrew chat --console --agent-config /home/agentcrew/.AgentCrew/agents.toml# Basic server
docker run -d -p 41241:41241 daltonnyx/agentcrew a2a-server
# Server with specific provider and API key
docker run -d -p 41241:41241 \
-e OPENAI_API_KEY="your_key" \
daltonnyx/agentcrew a2a-server --provider openai --host 0.0.0.0 --port 41241
# Server with authentication
docker run -d -p 41241:41241 \
daltonnyx/agentcrew a2a-server --api-key "your_server_auth_key"# Authenticate with GitHub Copilot (interactive)
docker run -it --rm \
-v agentcrew_data:/home/agentcrew/.AgentCrew \
daltonnyx/agentcrew copilot-auth- The container creates persistent volumes for conversation memory and settings
- Use
docker volume pruneto clean up unused volumes
- A2A server mode exposes port 41241 by default
- Ensure the port is not already in use on your host system
- Verify API keys are correctly set as environment variables
- Check that the API keys have sufficient permissions and quota
- Use the config.json file for persistent API key storage
# 1. Create a project directory
mkdir agentcrew-docker && cd agentcrew-docker
# 2. Create environment file
cat > .env << EOF
ANTHROPIC_API_KEY=your_claude_api_key
OPENAI_API_KEY=your_openai_api_key
EOF
# 3. Create custom agents configuration
cat > agents.toml << EOF
[[agents]]
name = "assistant"
description = "General AI Assistant"
system_prompt = """You are a helpful AI assistant.
Current date: {current_date}
"""
tools = ["memory", "clipboard", "web_search", "code_analysis"]
EOF
# 4. Build and run
docker run -it --rm \
--env-file .env \
-v $(pwd)/agents.toml:/home/agentcrew/.AgentCrew/agents.toml:ro \
-v agentcrew_data:/home/agentcrew/.AgentCrew \
daltonnyx/agentcrew chat --console# Run as production A2A server with restart policy
docker run -d \
--name agentcrew-prod \
--restart unless-stopped \
-p 41241:41241 \
-v agentcrew_prod_data:/home/agentcrew/.AgentCrew \
-e ANTHROPIC_API_KEY="your_api_key" \
daltonnyx/agentcrew a2a-server \
--host 0.0.0.0 \
--port 41241 \
--api-key "your_server_auth_key"-
API Keys: Never include API keys in the Docker image. Always use environment variables or mounted config files.
-
Authentication: Use the
--api-keyoption for A2A server mode in production. -
Network: Consider using Docker networks or reverse proxies for production deployments.
-
File Permissions: The container runs as non-root user
agentcrewfor security. -
X11 Security: Be cautious with X11 forwarding in production environments.
If you want to modify the image:
# Clone the repository
git clone https://github.com/saigontechnology/AgentCrew.git
cd AgentCrew
# Build custom image
docker build -t my-agentcrew .
# Or with build arguments (if needed)
docker build --build-arg PYTHON_VERSION=3.12 -t my-agentcrew .