A simple Docker Compose configuration for running AgentZero locally.
- Docker and Docker Compose installed
- Anthropic API key
-
Clone or download this directory
-
Set your API key
Option 1: Using .env file (recommended)
Copy the example file and add your API key:
cp .env.example .env
Then edit
.envand replaceyour-api-key-herewith your actual Anthropic API key.Option 2: Using environment variable
Export the API key in your shell:
export ANTHROPIC_API_KEY=your-api-key-here -
Start the container
docker compose up -d
-
Access AgentZero
Open your browser and navigate to: http://localhost:50502
The default port mapping is 50502:80. To change the host port, modify the ports section:
ports:
- "YOUR_PORT:80"| Host Path | Container Path | Description |
|---|---|---|
./agent-zero-data |
/a0 |
AgentZero persistent data (settings, history, etc.) |
| Custom paths | /srv/* |
Additional mounted directories for file access |
To give AgentZero access to additional directories, add more volume mounts:
volumes:
- ./agent-zero-data:/a0
- /path/to/your/project:/srv/project-name| Variable | Required | Description |
|---|---|---|
ANTHROPIC_API_KEY |
Yes | Your Anthropic API key for Claude models |
| Command | Description |
|---|---|
docker compose up -d |
Start AgentZero in background |
docker compose down |
Stop and remove the container |
docker compose logs -f |
View logs in real-time |
docker compose restart |
Restart the container |
docker compose pull |
Update to the latest image |
All AgentZero data is stored in ./agent-zero-data. This includes:
- User settings
- Conversation history
- Custom tools and prompts
To reset AgentZero, stop the container and remove this directory:
docker compose down
rm -rf agent-zero-dataImportant: Never commit your API key to version control.
This setup uses a .env file which is already included in .gitignore. The docker-compose.yml references the API key via ${ANTHROPIC_API_KEY} environment variable.
For production deployments, consider using Docker secrets or a secrets management system.
Check logs for errors:
docker compose logs agent-zeroChange the host port in docker-compose.yml or stop the conflicting service.
Ensure Docker has access to mounted directories on your system.