Docker Configuration
Advanced Docker setup and configuration options.
Basic Setup
git clone https://github.com/chriswritescode-dev/opencode-manager.git
cd opencode-manager
docker-compose up -d
docker-compose.yml
Default configuration:
version: '3.8'
services:
opencode-manager:
build: .
container_name: opencode-manager
ports:
- "5003:5003" # OpenCode Manager
- "5100:5100" # Dev server 1
- "5101:5101" # Dev server 2
- "5102:5102" # Dev server 3
- "5103:5103" # Dev server 4
volumes:
- ./workspace:/workspace
- ./data:/app/data
- opencode-cache:/root/.opencode
environment:
- NODE_ENV=production
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5003/health"]
interval: 30s
timeout: 10s
retries: 3
volumes:
opencode-cache:
Port Configuration
Main Application
The application runs on port 5003 by default:
Change the host port if needed:
Dev Server Ports
Ports 5100-5103 are exposed for running dev servers inside repositories:
Configure your dev server to use one of these ports:
Volume Mounts
Workspace
Repository storage:
All cloned repositories are stored here. The directory is created automatically.
Data
Database and configuration:
Contains: - SQLite database - User settings - Session data
OpenCode Cache
OpenCode runtime cache:
Using a named volume for better performance.
Environment Variables
Using .env File
Create .env in project root:
Reference in docker-compose.yml:
Inline Environment
Set directly in docker-compose.yml:
Health Checks
The container includes health checks:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5003/health"]
interval: 30s
timeout: 10s
retries: 3
Check health status:
Resource Limits
Limit container resources:
services:
opencode-manager:
# ... other config
deploy:
resources:
limits:
cpus: '2'
memory: 4G
reservations:
cpus: '0.5'
memory: 1G
Networking
Custom Network
Create an isolated network:
Host Network
Use host networking (Linux only):
Commands
Basic Operations
# Start
docker-compose up -d
# Stop
docker-compose down
# Restart
docker-compose restart
# View logs
docker-compose logs -f
# View logs (last 100 lines)
docker-compose logs --tail 100
Maintenance
# Rebuild image
docker-compose build
# Rebuild without cache
docker-compose build --no-cache
# Pull latest base images
docker-compose pull
# Update and restart
docker-compose pull && docker-compose up -d --build
Debugging
# Access shell
docker exec -it opencode-manager sh
# View running processes
docker exec opencode-manager ps aux
# Check disk usage
docker exec opencode-manager df -h
# View environment
docker exec opencode-manager env
Global Agent Instructions
The container creates a default AGENTS.md file at /workspace/.config/opencode/AGENTS.md.
Default Content
Instructions for AI agents working in the container: - Reserved ports information - Available dev server ports - Docker-specific guidelines
Editing
Via UI: Settings > OpenCode > Global Agent Instructions
Via File:
Precedence
Global instructions merge with repository-specific AGENTS.md files. Repository instructions take precedence.
Troubleshooting
Container Won't Start
# Check logs
docker-compose logs
# Check if port is in use
lsof -i :5003
# Try running in foreground
docker-compose up
Permission Issues
# Fix workspace permissions
sudo chown -R $(id -u):$(id -g) ./workspace ./data
# Or run with specific user
docker-compose run --user $(id -u):$(id -g) opencode-manager