docker-compose.yamlā¢2.08 kB
services:
docker-mcp:
# image: docker-mcp-debug:latest
build: . # Rebuild with the hot reload fix
# image: ghcr.io/jmagar/docker-mcp:latest
# pull_policy: always
container_name: docker-mcp
restart: unless-stopped
ports:
- "${FASTMCP_PORT:-8000}:${FASTMCP_PORT:-8000}"
env_file:
- .env
volumes:
# Docker MCP SSH keys only - mounted read-only for security
- ${SSH_KEYS_HOST_PATH:-~/.docker-mcp/ssh}:/home/dockermcp/.ssh:ro
# Configuration - mounted read-only
- ./config:/app/config:ro
# Persistent data volume for logs and state
- docker-mcp-data:/app/data
# Optional: Mount Docker socket if managing local Docker
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
# Override paths for container context
DOCKER_HOSTS_CONFIG: "/app/config/hosts.yml"
SSH_CONFIG_PATH: "/home/dockermcp/.ssh/config"
LOG_DIR: "/app/data/logs"
FASTMCP_DATA_DIR: "/app/data"
DOCKER_MCP_DATA_DIR: "/app/data"
# Enable colored output in Docker logs
FORCE_COLOR: "true"
# Health check (using internal endpoint check)
healthcheck:
test: ["CMD-SHELL", "python -c \"import os,socket; socket.create_connection(('localhost', int(os.getenv('FASTMCP_PORT','8000'))), timeout=5)\""]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Resource limits (optional - uncomment to enable)
# deploy:
# resources:
# limits:
# cpus: '2'
# memory: 2G
# reservations:
# cpus: '0.5'
# memory: 512M
# Logging configuration
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Network mode - use host network for better Docker connectivity
# Uncomment if needed for specific network requirements
# network_mode: host
volumes:
docker-mcp-data:
driver: local
networks:
default:
name: docker-mcp-network
driver: bridge