
Docker Debugging
- 26 installs
- 2 repo stars
- Updated January 5, 2026
- pluginagentmarketplace/custom-plugin-docker
docker-debugging is an agent skill that supplies categorized Docker CLI commands for inspecting containers, logs, exec sessions, networks, and disk usage.
About
Docker Debugging Commands Reference is a compact command cheat sheet for solo and indie builders who run services in containers on laptops, CI, or small VPS fleets. It groups everyday Docker workflows into five areas so you do not search Stack Overflow while a deploy is red: container inspection for IDs, ports, and live stats; log analysis with follow, tail, timestamps, and time-bounded since queries; interactive debugging via docker exec for shells and one-off commands; network debugging for DNS, ping, and listening ports; and resource analysis starting with docker system df for disk pressure. The skill does not replace observability stacks—it gives procedural knowledge your coding agent can cite while you pair on incidents. Use it when stdout is empty, health checks fail, or a service cannot reach another container on the compose network. Intermediate familiarity with container IDs and compose service names is assumed.
- Five reference blocks: container_inspection, log_analysis, interactive_debugging, network_debugging, resource_analysis
- Inspection shortcuts: inspect, top, stats, and port mappings for a given container ID
- Log recipes: follow, tail 100 lines, timestamps, and --since windows for incident windows
- Interactive exec: bash/sh, arbitrary commands, and root exec for permission issues
- Network checks: network inspect, nslookup, ping, and netstat inside the container
Docker Debugging by the numbers
- 26 all-time installs (skills.sh)
- Ranked #384 of 610 Debugging skills by installs in the Skillselion catalog
- Security screen: HIGH risk (skills.sh audit)
- Data as of Jul 26, 2026 (Skillselion catalog sync)
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-docker --skill docker-debuggingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 26 |
|---|---|
| repo stars | ★ 2 |
| Security audit | 2 / 3 scanners passed |
| Last updated | January 5, 2026 |
| Repository | pluginagentmarketplace/custom-plugin-docker ↗ |
What it does
Quick-copy Docker CLI recipes when a developer’s container misbehaves in dev or production.
Who is it for?
Best when you're debugging compose stacks, side projects on Docker Desktop, or single-node production without a dedicated SRE runbook.
Skip if: Skip if you already rely on full APM/tracing with no shell access policy exceptions, or pure Kubernetes-only workflows where kubectl debug replaces docker exec.
When should I use this skill?
A container fails health checks, logs are unclear, or you need exec/network verification on a running Docker workload.
What you get
You get a structured command list to inspect state, stream logs, shell in, and test connectivity so you can isolate the failure faster.
- Ordered Docker CLI commands for the active incident scenario
- Log tail/follow commands with time windows for correlation
- In-container network and process checks to narrow root cause
By the numbers
- 5 command reference categories: inspection, logs, exec, network, resources
Files
Docker Debugging Skill
Master container debugging and troubleshooting for development and production issues.
Purpose
Diagnose and resolve container issues including crashes, performance problems, networking failures, and resource constraints.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| container | string | No | - | Container name/ID |
| issue_type | enum | No | - | crash/network/resource/health |
| verbose | boolean | No | false | Detailed output |
Debugging Commands
Container Logs
# Last 100 lines
docker logs --tail 100 <container>
# Follow logs
docker logs -f <container>
# With timestamps
docker logs -t <container>
# Specific time range
docker logs --since 1h --until 30m <container>Interactive Debugging
# Execute shell in running container
docker exec -it <container> /bin/sh
# As root (for debugging)
docker exec -u 0 -it <container> /bin/sh
# Run command
docker exec <container> ps auxContainer Inspection
# Full inspection
docker inspect <container>
# Specific fields
docker inspect --format='{{.State.Status}}' <container>
docker inspect --format='{{.State.Health.Status}}' <container>
docker inspect --format='{{json .NetworkSettings}}' <container>Issue Diagnosis
Container Won't Start
# Check exit code
docker inspect --format='{{.State.ExitCode}}' <container>
# View last logs
docker logs --tail 50 <container>
# Check events
docker events --filter 'container=<name>' --since 1hExit Code Reference
| Code | Meaning | Action |
|---|---|---|
| 0 | Success | Normal exit |
| 1 | General error | Check logs |
| 137 | OOMKilled | Increase memory |
| 139 | Segfault | Check app code |
| 143 | SIGTERM | Graceful shutdown |
Health Check Failures
# Check health status
docker inspect --format='{{json .State.Health}}' <container>
# View health logs
docker inspect --format='{{range .State.Health.Log}}{{.Output}}{{end}}' <container>
# Manually test health
docker exec <container> curl -f http://localhost/healthResource Issues
# Live stats
docker stats <container>
# Formatted output
docker stats --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}"
# Check limits
docker inspect --format='{{.HostConfig.Memory}}' <container>Network Issues
# Check network
docker network inspect <network>
# Test DNS
docker exec <container> nslookup <service>
# Test connectivity
docker exec <container> ping -c 3 <target>
docker exec <container> curl http://<service>:port
# View ports
docker port <container>Troubleshooting Flowchart
Container Issue?
│
├─ Won't Start
│ ├─ Check logs: docker logs <c>
│ ├─ Check exit code: docker inspect
│ └─ Verify image: docker pull
│
├─ Unhealthy
│ ├─ Check health logs
│ ├─ Test health endpoint manually
│ └─ Increase start_period
│
├─ High Resource
│ ├─ Check stats: docker stats
│ ├─ Increase limits
│ └─ Profile application
│
└─ Network Failed
├─ Check DNS: nslookup
├─ Check connectivity: ping/curl
└─ Verify network membershipDebug Container
# Run debug container in same network
docker run --rm -it --network <network> \
nicolaka/netshoot
# Available tools: curl, dig, nmap, tcpdump, etc.Error Handling
Common Errors
| Error | Cause | Solution |
|---|---|---|
container not found | Wrong name/ID | Use docker ps -a |
exec failed | Container stopped | Start container first |
no such file | Missing binary | Use correct image |
Usage
Skill("docker-debugging")Assets
assets/debug-commands.yaml- Command referencescripts/container-health-check.sh- Health check script
Related Skills
- docker-production
- docker-networking
# Docker Debugging Commands Reference
# Version: 1.0.0
# Last Updated: 2025-12-29
container_inspection:
# View container details
inspect: "docker inspect <container_id>"
# View running processes
top: "docker top <container_id>"
# View resource usage
stats: "docker stats <container_id> --no-stream"
# View port mappings
port: "docker port <container_id>"
log_analysis:
# View all logs
all_logs: "docker logs <container_id>"
# Follow logs in real-time
follow: "docker logs -f <container_id>"
# Last N lines
tail: "docker logs --tail 100 <container_id>"
# With timestamps
timestamps: "docker logs -t <container_id>"
# Since specific time
since: "docker logs --since 30m <container_id>"
interactive_debugging:
# Start bash in running container
exec_bash: "docker exec -it <container_id> /bin/bash"
# Start sh (if bash not available)
exec_sh: "docker exec -it <container_id> /bin/sh"
# Run specific command
exec_cmd: "docker exec <container_id> <command>"
# As root user
exec_root: "docker exec -u root -it <container_id> /bin/bash"
network_debugging:
# View container networks
network_inspect: "docker network inspect <network_name>"
# Test DNS resolution
dns_test: "docker exec <container_id> nslookup <hostname>"
# Test connectivity
ping_test: "docker exec <container_id> ping -c 3 <target>"
# Check open ports
netstat: "docker exec <container_id> netstat -tlnp"
resource_analysis:
# Disk usage
system_df: "docker system df -v"
# Container size
container_size: "docker ps -s"
# Image layers
image_history: "docker history <image>"
health_checks:
# View health status
health_status: "docker inspect --format='{{.State.Health.Status}}' <container_id>"
# View health logs
health_log: "docker inspect --format='{{range .State.Health.Log}}{{.Output}}{{end}}' <container_id>"
common_issues:
container_not_starting:
- "Check logs: docker logs <container_id>"
- "Check exit code: docker inspect -f '{{.State.ExitCode}}' <container_id>"
- "Review entrypoint/cmd in Dockerfile"
high_memory_usage:
- "Check limits: docker stats"
- "Add memory limit: --memory=512m"
- "Review application memory leaks"
network_issues:
- "Check network mode: docker inspect -f '{{.NetworkSettings.Networks}}' <container_id>"
- "Verify DNS: docker exec <container_id> cat /etc/resolv.conf"
- "Test inter-container: docker exec <container_id> ping <other_container>"
Docker Debugging Guide
Quick Reference
Container Won't Start
1. Check exit code:
docker inspect -f '{{.State.ExitCode}}' <container>- Exit 0: Normal termination
- Exit 1: Application error
- Exit 137: OOM killed (out of memory)
- Exit 139: Segmentation fault
- Exit 143: SIGTERM received
2. View logs:
docker logs <container>3. Debug entrypoint:
docker run -it --entrypoint /bin/sh <image>High Memory Usage
1. Check current usage:
docker stats <container>2. Set memory limits:
docker run -m 512m --memory-swap 1g <image>3. Find memory hogs:
docker exec <container> ps aux --sort=-%mem | headNetwork Issues
1. Container can't reach internet:
# Check DNS
docker exec <container> cat /etc/resolv.conf
# Test connectivity
docker exec <container> ping -c 3 8.8.8.82. Containers can't communicate:
# Ensure same network
docker network inspect <network>
# Use container name as hostname
docker exec <container1> ping <container2_name>Disk Space Issues
1. Check Docker disk usage:
docker system df -v2. Cleanup unused resources:
# Remove unused containers, networks, images
docker system prune -a
# Remove unused volumes
docker volume pruneBest Practices
1. Always use health checks in Dockerfiles 2. Set resource limits to prevent runaway containers 3. Use logging drivers for centralized log management 4. Tag images properly for easier debugging 5. Keep containers stateless - data in volumes
#!/bin/bash
# Container Health Check Script
# Version: 1.0.0
# Usage: ./container-health-check.sh <container_id_or_name>
set -e
CONTAINER=${1:-}
if [ -z "$CONTAINER" ]; then
echo "Usage: $0 <container_id_or_name>"
exit 1
fi
echo "=========================================="
echo "Container Health Check Report"
echo "Container: $CONTAINER"
echo "Date: $(date)"
echo "=========================================="
# Check if container exists
if ! docker inspect "$CONTAINER" > /dev/null 2>&1; then
echo "ERROR: Container '$CONTAINER' not found"
exit 1
fi
# Basic Info
echo ""
echo "--- Basic Information ---"
docker inspect --format='Name: {{.Name}}' "$CONTAINER"
docker inspect --format='Image: {{.Config.Image}}' "$CONTAINER"
docker inspect --format='Status: {{.State.Status}}' "$CONTAINER"
docker inspect --format='Started: {{.State.StartedAt}}' "$CONTAINER"
# Health Status
echo ""
echo "--- Health Status ---"
HEALTH=$(docker inspect --format='{{if .State.Health}}{{.State.Health.Status}}{{else}}no healthcheck{{end}}' "$CONTAINER")
echo "Health: $HEALTH"
if [ "$HEALTH" != "no healthcheck" ]; then
echo "Last Health Check:"
docker inspect --format='{{range $i, $h := .State.Health.Log}}{{if eq $i 0}}Exit: {{$h.ExitCode}} - {{$h.Output}}{{end}}{{end}}' "$CONTAINER" 2>/dev/null || echo "No health log available"
fi
# Resource Usage
echo ""
echo "--- Resource Usage ---"
docker stats "$CONTAINER" --no-stream --format "CPU: {{.CPUPerc}} | Memory: {{.MemUsage}} | Net I/O: {{.NetIO}} | Block I/O: {{.BlockIO}}"
# Network Info
echo ""
echo "--- Network Configuration ---"
docker inspect --format='{{range $net, $conf := .NetworkSettings.Networks}}Network: {{$net}} | IP: {{$conf.IPAddress}}{{end}}' "$CONTAINER"
# Port Mappings
echo ""
echo "--- Port Mappings ---"
docker port "$CONTAINER" 2>/dev/null || echo "No ports exposed"
# Recent Logs
echo ""
echo "--- Recent Logs (last 10 lines) ---"
docker logs --tail 10 "$CONTAINER" 2>&1
# Running Processes
echo ""
echo "--- Running Processes ---"
docker top "$CONTAINER" 2>/dev/null || echo "Unable to get process list"
echo ""
echo "=========================================="
echo "Health Check Complete"
echo "=========================================="
Related skills
How it compares
Use as a procedural CLI playbook instead of asking the agent to improvise docker commands from memory.
FAQ
Who is docker-debugging for?
Developers and small teams shipping containerized apps who want copy-paste Docker debugging steps during incidents or local dev failures.
When should I use docker-debugging?
In Operate when containers crash-loop or miss dependencies; in Ship when CI-built images fail smoke tests; in Build when compose networking blocks API calls between services.
Is docker-debugging safe to install?
It is reference documentation for powerful host and container commands—review the Security Audits panel on this page and restrict exec/root usage on production systems.