Diagnose Docker issues - container failures, networking problems, permission errors, and port conflicts
Diagnoses Docker container failures, networking issues, and permission errors with specific fixes.
/plugin marketplace add mwguerra/claude-code-plugins/plugin install taskmanager@mwguerra-marketplace<issue-description> [--container name] [--fix]You are diagnosing Docker problems. Follow these steps:
Run diagnostic commands:
# Check container status
docker compose ps -a
# View recent logs
docker compose logs --tail=100
# Check configuration
docker compose config
# Check system resources
docker system df
docker stats --no-stream
Read the documentation:
skills/docker-docs/references/17-troubleshooting.md for common issuesskills/docker-docs/references/15-port-conflicts.md for port problemsskills/docker-docs/references/16-restart-strategies.md for restart issues# Check logs
docker compose logs servicename
# Check exit code
docker inspect --format='{{.State.ExitCode}}' containername
# Find process using port
lsof -i :3000
# or
netstat -tulpn | grep 3000
# Kill the process
kill $(lsof -t -i:3000)
# Check file ownership
docker compose exec app ls -la /app/data
# Fix in container
docker compose exec -u root app chown -R appuser:appgroup /app/data
Or fix in compose:
services:
app:
user: "1000:1000"
# Test DNS resolution
docker compose exec app nslookup db
# Test connectivity
docker compose exec app ping db
# Check networks
docker network inspect networkname
Ensure services are on the same network:
services:
app:
networks:
- backend
db:
networks:
- backend
Check volume configuration:
docker volume ls
docker compose config | grep -A5 "volumes:"
Use named volumes (not anonymous):
volumes:
- postgres_data:/var/lib/postgresql/data # Named (persists)
# NOT: - /var/lib/postgresql/data # Anonymous (deleted)
# Check health status
docker inspect --format='{{json .State.Health}}' containername | jq
Adjust health check timing:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s # Give more time to start
# Check Docker disk usage
docker system df -v
# Clean unused resources
docker system prune -a --volumes
# Rebuild without cache
docker compose build --no-cache
# Clean build cache
docker builder prune -a
# Shell into running container
docker compose exec app sh
# Shell into failed container
docker compose run --entrypoint sh app
# View container processes
docker compose top
# Real-time events
docker events
# Copy files from container
docker compose cp app:/app/logs ./logs
After diagnosis, provide:
$ARGUMENTS