Docker Management via MCP
Use this skill when you need to manage Docker containers, inspect logs, run commands inside containers, or check resource usage.
Available Tools
| Tool | What it does |
|---|---|
list_containers |
List running (or all) containers with status, ports, image |
container_logs |
Get recent logs from a container |
start_container |
Start a stopped container |
stop_container |
Stop a running container |
restart_container |
Restart a container |
remove_container |
Remove a container (optional force) |
exec_command |
Execute a command inside a running container |
container_stats |
Get live CPU, memory, and network stats |
list_images |
List all Docker images on the host |
remove_image |
Remove a Docker image |
Workflow
- Start with
list_containersto see what's running - Use container names or IDs from the list for all other operations
- For debugging:
container_logsfirst, thenexec_commandto investigate - Use
container_statsto check resource usage when diagnosing performance issues
Key Patterns
list_containersshows only running containers by default; passall: truefor stopped ones toocontainer_logsreturns the last N lines; passtailto control how manyexec_commandruns inside a running container; the container must be started firstremove_containerwithforce: truestops and removes in one step
Error Scenarios
- Cannot connect to Docker: Docker Desktop/daemon not running or MCP lacks socket permissions
- Container not found: run
list_containerswithall: truefor stopped IDs/names exec_commandfails: container must be running; shell may not exist in minimal images- Empty logs: container just started or logging driver differs; increase
tailor check app stdout
Safety
- Always confirm before stopping or removing containers
- Never remove containers in production without explicit user approval
- Check
container_statsbefore restarting to understand if the issue is resource-related