[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6MSHZ0W9VZR77YVHKBKRX7X":3,"skill-same:01M6MSHZ0W9VZR77YVHKBKRX7X":77},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":49,"commitSha":50,"skillDirectory":51,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":6,"ownerDescription":55,"updatedAt":56,"install":57,"resources":70},"01M6MSHZ0W9VZR77YVHKBKRX7X","container-debug",null,"Debug running Docker containers and Compose services. Use when inspecting container logs, exec-ing into running containers, diagnosing networking issues, checking resource usage, debugging multi-stage builds, troubleshooting health checks, or fixing Compose service dependencies.","Kernel8901\u002Fai-agent-skills-classification","Kernel8901","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F72647553?v=4","01M6KV388J2H5PNC8D8P940BJD","01M6KV38CS5B3AY63RKZB410YM",7,"MIT","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002FDevOps与云计算\u002Fcontainer-debug\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"debug","container debug","container","health","darwin","usage","multi","stage","dependencies","compose","use","containers","services","logs","issues","win32","networking","debugging","linux","docker","2026-11-10 10:12:30",false,"---\nname: container-debug\ndescription: Debug running Docker containers and Compose services. Use when inspecting container logs, exec-ing into running containers, diagnosing networking issues, checking resource usage, debugging multi-stage builds, troubleshooting health checks, or fixing Compose service dependencies.\nmetadata: {\"clawdbot\":{\"emoji\":\"?\",\"requires\":{\"bins\":[\"docker\"]},\"os\":[\"linux\",\"darwin\",\"win32\"]}}\n---\n\n# Container Debug\n\nDebug running Docker containers and Compose services. Covers logs, exec, networking, resource inspection, multi-stage builds, health checks, and common failure patterns.\n\n## When to Use\n\n- Container exits immediately or crashes on start\n- Application inside container behaves differently than on host\n- Containers can't communicate with each other\n- Container is using too much memory or CPU\n- Multi-stage Docker build produces unexpected results\n- Health checks are failing\n- Compose services start in wrong order or can't connect\n\n## Container Logs\n\n### View and filter logs\n\n```bash\n# Last 100 lines\ndocker logs --tail 100 my-container\n\n# Follow (stream) logs\ndocker logs -f my-container\n\n# Follow with timestamps\ndocker logs -f -t my-container\n\n# Logs since a time\ndocker logs --since 30m my-container\ndocker logs --since \"2026-02-03T10:00:00\" my-container\n\n# Logs between times\ndocker logs --since 1h --until 30m my-container\n\n# Compose: logs for all services\ndocker compose logs -f\n\n# Compose: logs for specific service\ndocker compose logs -f api db\n\n# Redirect logs to file for analysis\ndocker logs my-container > container.log 2>&1\n\n# Separate stdout and stderr\ndocker logs my-container > stdout.log 2> stderr.log\n```\n\n### Inspect log driver\n\n```bash\n# Check what log driver a container uses\ndocker inspect --format='{{.HostConfig.LogConfig.Type}}' my-container\n\n# If json-file driver, find the actual log file\ndocker inspect --format='{{.LogPath}}' my-container\n\n# Check log file size\nls -lh $(docker inspect --format='{{.LogPath}}' my-container)\n```\n\n## Exec Into Containers\n\n### Interactive shell\n\n```bash\n# Bash (most common)\ndocker exec -it my-container bash\n\n# If bash isn't available (Alpine, distroless)\ndocker exec -it my-container sh\n\n# As root (even if container runs as non-root user)\ndocker exec -u root -it my-container bash\n\n# With specific environment variables\ndocker exec -e DEBUG=1 -it my-container bash\n\n# Run a single command (no interactive shell)\ndocker exec my-container cat \u002Fetc\u002Fos-release\ndocker exec my-container ls -la \u002Fapp\u002F\ndocker exec my-container env\n```\n\n### Debug a crashed container\n\n```bash\n# Container exited? Check exit code\ndocker inspect --format='{{.State.ExitCode}}' my-container\ndocker inspect --format='{{.State.Error}}' my-container\n\n# Common exit codes:\n# 0   = clean exit\n# 1   = application error\n# 137 = killed (OOM or docker kill) — 128 + signal 9\n# 139 = segfault — 128 + signal 11\n# 143 = terminated (SIGTERM) — 128 + signal 15\n\n# Start a stopped container to debug it\ndocker start -ai my-container\n\n# Or override the entrypoint to get a shell\ndocker run -it --entrypoint sh my-image\n\n# Copy files out of a stopped container\ndocker cp my-container:\u002Fapp\u002Ferror.log .\u002Ferror.log\ndocker cp my-container:\u002Fetc\u002Fnginx\u002Fnginx.conf .\u002Fnginx.conf\n```\n\n### Debug without a shell (distroless \u002F scratch images)\n\n```bash\n# Use docker cp to extract files\ndocker cp my-container:\u002Fapp\u002Fconfig.json .\u002F\n\n# Use nsenter to get a shell in the container's namespace (Linux)\nPID=$(docker inspect --format='{{.State.Pid}}' my-container)\nnsenter -t $PID -m -u -i -n -p -- \u002Fbin\u002Fsh\n\n# Attach a debug container to the same namespace\ndocker run -it --pid=container:my-container --net=container:my-container busybox sh\n\n# Docker Desktop: use debug extension\ndocker debug my-container\n```\n\n## Networking\n\n### Inspect container networking\n\n```bash\n# Show container IP address\ndocker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' my-container\n\n# Show all network details\ndocker inspect -f '{{json .NetworkSettings.Networks}}' my-container | jq\n\n# List all networks\ndocker network ls\n\n# Inspect a network (see all connected containers)\ndocker network inspect bridge\ndocker network inspect my-compose-network\n\n# Show port mappings\ndocker port my-container\n```\n\n### Test connectivity between containers\n\n```bash\n# From inside container A, reach container B\ndocker exec container-a ping container-b\ndocker exec container-a curl http:\u002F\u002Fcontainer-b:8080\u002Fhealth\n\n# DNS resolution inside container\ndocker exec my-container nslookup db\ndocker exec my-container cat \u002Fetc\u002Fresolv.conf\ndocker exec my-container cat \u002Fetc\u002Fhosts\n\n# Test if port is reachable\ndocker exec my-container nc -zv db 5432\ndocker exec my-container wget -qO- http:\u002F\u002Fapi:3000\u002Fhealth\n\n# If curl\u002Fping not available in container, install or use a debug container:\ndocker run --rm --network container:my-container curlimages\u002Fcurl curl -s http:\u002F\u002Flocalhost:8080\n```\n\n### Common networking issues\n\n```bash\n# \"Connection refused\" between containers\n# 1. Check the app binds to 0.0.0.0, not 127.0.0.1\ndocker exec my-container netstat -tlnp\n# If listening on 127.0.0.1 — fix the app config\n\n# 2. Check containers are on the same network\ndocker inspect -f '{{json .NetworkSettings.Networks}}' container-a | jq 'keys'\ndocker inspect -f '{{json .NetworkSettings.Networks}}' container-b | jq 'keys'\n\n# 3. Check published ports vs exposed ports\n# EXPOSE only documents, it doesn't publish\n# Use -p host:container to publish\n\n# \"Name not found\" — DNS not resolving container names\n# Container names resolve only on user-defined networks, NOT the default bridge\ndocker network create my-net\ndocker run --network my-net --name api my-api-image\ndocker run --network my-net --name db postgres\n# Now \"api\" and \"db\" resolve to each other\n```\n\n### Capture network traffic\n\n```bash\n# tcpdump inside a container\ndocker exec my-container tcpdump -i eth0 -n port 8080\n\n# If tcpdump not available, use a sidecar\ndocker run --rm --net=container:my-container nicolaka\u002Fnetshoot tcpdump -i eth0 -n\n\n# netshoot has: tcpdump, curl, nslookup, netstat, iperf, etc.\ndocker run --rm --net=container:my-container nicolaka\u002Fnetshoot bash\n```\n\n## Resource Usage\n\n### Real-time stats\n\n```bash\n# All containers\ndocker stats\n\n# Specific containers\ndocker stats api db redis\n\n# One-shot (no streaming)\ndocker stats --no-stream\n\n# Formatted output\ndocker stats --format \"table {{.Name}}\\t{{.CPUPerc}}\\t{{.MemUsage}}\\t{{.NetIO}}\"\n```\n\n### Memory investigation\n\n```bash\n# Check memory limit\ndocker inspect --format='{{.HostConfig.Memory}}' my-container\n# 0 means unlimited\n\n# Check if container was OOM-killed\ndocker inspect --format='{{.State.OOMKilled}}' my-container\n\n# Memory usage breakdown (Linux cgroups)\ndocker exec my-container cat \u002Fsys\u002Ffs\u002Fcgroup\u002Fmemory.current 2>\u002Fdev\u002Fnull || \\\ndocker exec my-container cat \u002Fsys\u002Ffs\u002Fcgroup\u002Fmemory\u002Fmemory.usage_in_bytes\n\n# Process memory inside container\ndocker exec my-container ps aux --sort=-%mem | head -10\ndocker exec my-container top -bn1\n```\n\n### Disk usage\n\n```bash\n# Overall Docker disk usage\ndocker system df\ndocker system df -v\n\n# Container filesystem size\ndocker inspect --format='{{.SizeRw}}' my-container\n\n# Find large files inside container\ndocker exec my-container du -sh \u002F* 2>\u002Fdev\u002Fnull | sort -rh | head -10\ndocker exec my-container find \u002Ftmp -size +10M -type f\n\n# Check for log file bloat\ndocker exec my-container ls -lh \u002Fvar\u002Flog\u002F\n```\n\n## Dockerfile Debugging\n\n### Multi-stage build debugging\n\n```bash\n# Build up to a specific stage\ndocker build --target builder -t my-app:builder .\n\n# Inspect what's in the builder stage\ndocker run --rm -it my-app:builder sh\ndocker run --rm my-app:builder ls -la \u002Fapp\u002F\ndocker run --rm my-app:builder cat \u002Fapp\u002Fpackage.json\n\n# Check which files made it to the final image\ndocker run --rm my-image ls -laR \u002Fapp\u002F\n\n# Build with no cache (fresh build)\ndocker build --no-cache -t my-app .\n\n# Build with progress output\ndocker build --progress=plain -t my-app .\n```\n\n### Image inspection\n\n```bash\n# Show image layers (size of each)\ndocker history my-image\ndocker history --no-trunc my-image\n\n# Inspect image config (entrypoint, cmd, env, ports)\ndocker inspect my-image | jq '.[0].Config | {Cmd, Entrypoint, Env, ExposedPorts, WorkingDir}'\n\n# Compare two images\ndocker history image-a --format \"{{.Size}}\\t{{.CreatedBy}}\" > layers-a.txt\ndocker history image-b --format \"{{.Size}}\\t{{.CreatedBy}}\" > layers-b.txt\ndiff layers-a.txt layers-b.txt\n\n# Find what changed between builds\ndocker diff my-container\n# A = added, C = changed, D = deleted\n```\n\n## Health Checks\n\n### Define and debug health checks\n\n```dockerfile\n# In Dockerfile\nHEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \\\n  CMD curl -f http:\u002F\u002Flocalhost:8080\u002Fhealth || exit 1\n```\n\n```bash\n# Check health status\ndocker inspect --format='{{.State.Health.Status}}' my-container\n# \"healthy\", \"unhealthy\", or \"starting\"\n\n# See health check log (last 5 results)\ndocker inspect --format='{{json .State.Health}}' my-container | jq\n\n# Run health check manually\ndocker exec my-container curl -f http:\u002F\u002Flocalhost:8080\u002Fhealth\n\n# Override health check at run time\ndocker run --health-cmd \"curl -f http:\u002F\u002Flocalhost:8080\u002Fhealth || exit 1\" \\\n           --health-interval 10s my-image\n\n# Disable health check\ndocker run --no-healthcheck my-image\n```\n\n## Docker Compose Debugging\n\n### Service startup issues\n\n```bash\n# Check service status\ndocker compose ps\n\n# See why a service failed\ndocker compose logs failed-service\n\n# Start with verbose output\ndocker compose up --build 2>&1 | tee compose.log\n\n# Start a single service (with dependencies)\ndocker compose up db\n\n# Start without dependencies\ndocker compose up --no-deps api\n\n# Recreate containers from scratch\ndocker compose up --force-recreate --build\n\n# Check effective config (after variable substitution)\ndocker compose config\n```\n\n### Service dependency and startup order\n\n```yaml\n# docker-compose.yml\nservices:\n  api:\n    depends_on:\n      db:\n        condition: service_healthy\n      redis:\n        condition: service_started\n\n  db:\n    image: postgres:16\n    healthcheck:\n      test: [\"CMD-SHELL\", \"pg_isready -U postgres\"]\n      interval: 5s\n      timeout: 5s\n      retries: 5\n\n  redis:\n    image: redis:7\n    healthcheck:\n      test: [\"CMD\", \"redis-cli\", \"ping\"]\n      interval: 5s\n      timeout: 5s\n      retries: 5\n```\n\n```bash\n# Wait for a service to be healthy before running commands\ndocker compose up -d db\ndocker compose exec db pg_isready  # Polls until ready\ndocker compose up -d api\n```\n\n## Cleanup\n\n```bash\n# Remove stopped containers\ndocker container prune\n\n# Remove unused images\ndocker image prune\n\n# Remove everything unused (containers, images, networks, volumes)\ndocker system prune -a\n\n# Remove volumes too (WARNING: deletes data)\ndocker system prune -a --volumes\n\n# Remove dangling build cache\ndocker builder prune\n```\n\n## Tips\n\n- `docker logs -f` is the first thing to check. Most container failures are visible in the logs.\n- Exit code 137 means OOM-killed. Increase the memory limit or fix the memory leak.\n- Apps inside containers must bind to `0.0.0.0`, not `127.0.0.1`. Localhost inside a container is isolated.\n- Container names only resolve via DNS on user-defined networks, not the default `bridge`. Always create a custom network for multi-container setups.\n- `docker exec` only works on running containers. For crashed containers, use `docker cp` to extract logs or override the entrypoint with `docker run --entrypoint sh`.\n- `nicolaka\u002Fnetshoot` is the Swiss Army knife for container networking. It has every networking tool pre-installed.\n- `--progress=plain` during builds shows full command output, which is essential for debugging build failures.\n- Health checks with `start-period` prevent false unhealthy status during slow application startup.\n","# Container Debug\n\nDebug running Docker containers and Compose services. Covers logs, exec, networking, resource inspection, multi-stage builds, health checks, and common failure patterns.\n\n## When to Use\n\n- Container exits immediately or crashes on start\n- Application inside container behaves differently than on host\n- Containers can't communicate with each other\n- Container is using too much memory or CPU\n- Multi-stage Docker build produces unexpected results\n- Health checks are failing\n- Compose services start in wrong order or can't connect\n\n## Container Logs\n\n### View and filter logs\n\n```bash\n# Last 100 lines\ndocker logs --tail 100 my-container\n\n# Follow (stream) logs\ndocker logs -f my-container\n\n# Follow with timestamps\ndocker logs -f -t my-container\n\n# Logs since a time\ndocker logs --since 30m my-container\ndocker logs --since \"2026-02-03T10:00:00\" my-container\n\n# Logs between times\ndocker logs --since 1h --until 30m my-container\n\n# Compose: logs for all services\ndocker compose logs -f\n\n# Compose: logs for specific service\ndocker compose logs -f api db\n\n# Redirect logs to file for analysis\ndocker logs my-container > container.log 2>&1\n\n# Separate stdout and stderr\ndocker logs my-container > stdout.log 2> stderr.log\n```\n\n### Inspect log driver\n\n```bash\n# Check what log driver a container uses\ndocker inspect --format='{{.HostConfig.LogConfig.Type}}' my-container\n\n# If json-file driver, find the actual log file\ndocker inspect --format='{{.LogPath}}' my-container\n\n# Check log file size\nls -lh $(docker inspect --format='{{.LogPath}}' my-container)\n```\n\n## Exec Into Containers\n\n### Interactive shell\n\n```bash\n# Bash (most common)\ndocker exec -it my-container bash\n\n# If bash isn't available (Alpine, distroless)\ndocker exec -it my-container sh\n\n# As root (even if container runs as non-root user)\ndocker exec -u root -it my-container bash\n\n# With specific environment variables\ndocker exec -e DEBUG=1 -it my-container bash\n\n# Run a single command (no interactive shell)\ndocker exec my-container cat \u002Fetc\u002Fos-release\ndocker exec my-container ls -la \u002Fapp\u002F\ndocker exec my-container env\n```\n\n### Debug a crashed container\n\n```bash\n# Container exited? Check exit code\ndocker inspect --format='{{.State.ExitCode}}' my-container\ndocker inspect --format='{{.State.Error}}' my-container\n\n# Common exit codes:\n# 0   = clean exit\n# 1   = application error\n# 137 = killed (OOM or docker kill) — 128 + signal 9\n# 139 = segfault — 128 + signal 11\n# 143 = terminated (SIGTERM) — 128 + signal 15\n\n# Start a stopped container to debug it\ndocker start -ai my-container\n\n# Or override the entrypoint to get a shell\ndocker run -it --entrypoint sh my-image\n\n# Copy files out of a stopped container\ndocker cp my-container:\u002Fapp\u002Ferror.log .\u002Ferror.log\ndocker cp my-container:\u002Fetc\u002Fnginx\u002Fnginx.conf .\u002Fnginx.conf\n```\n\n### Debug without a shell (distroless \u002F scratch images)\n\n```bash\n# Use docker cp to extract files\ndocker cp my-container:\u002Fapp\u002Fconfig.json .\u002F\n\n# Use nsenter to get a shell in the container's namespace (Linux)\nPID=$(docker inspect --format='{{.State.Pid}}' my-container)\nnsenter -t $PID -m -u -i -n -p -- \u002Fbin\u002Fsh\n\n# Attach a debug container to the same namespace\ndocker run -it --pid=container:my-container --net=container:my-container busybox sh\n\n# Docker Desktop: use debug extension\ndocker debug my-container\n```\n\n## Networking\n\n### Inspect container networking\n\n```bash\n# Show container IP address\ndocker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' my-container\n\n# Show all network details\ndocker inspect -f '{{json .NetworkSettings.Networks}}' my-container | jq\n\n# List all networks\ndocker network ls\n\n# Inspect a network (see all connected containers)\ndocker network inspect bridge\ndocker network inspect my-compose-network\n\n# Show port mappings\ndocker port my-container\n```\n\n### Test connectivity between containers\n\n```bash\n# From inside container A, reach container B\ndocker exec container-a ping container-b\ndocker exec container-a curl http:\u002F\u002Fcontainer-b:8080\u002Fhealth\n\n# DNS resolution inside container\ndocker exec my-container nslookup db\ndocker exec my-container cat \u002Fetc\u002Fresolv.conf\ndocker exec my-container cat \u002Fetc\u002Fhosts\n\n# Test if port is reachable\ndocker exec my-container nc -zv db 5432\ndocker exec my-container wget -qO- http:\u002F\u002Fapi:3000\u002Fhealth\n\n# If curl\u002Fping not available in container, install or use a debug container:\ndocker run --rm --network container:my-container curlimages\u002Fcurl curl -s http:\u002F\u002Flocalhost:8080\n```\n\n### Common networking issues\n\n```bash\n# \"Connection refused\" between containers\n# 1. Check the app binds to 0.0.0.0, not 127.0.0.1\ndocker exec my-container netstat -tlnp\n# If listening on 127.0.0.1 — fix the app config\n\n# 2. Check containers are on the same network\ndocker inspect -f '{{json .NetworkSettings.Networks}}' container-a | jq 'keys'\ndocker inspect -f '{{json .NetworkSettings.Networks}}' container-b | jq 'keys'\n\n# 3. Check published ports vs exposed ports\n# EXPOSE only documents, it doesn't publish\n# Use -p host:container to publish\n\n# \"Name not found\" — DNS not resolving container names\n# Container names resolve only on user-defined networks, NOT the default bridge\ndocker network create my-net\ndocker run --network my-net --name api my-api-image\ndocker run --network my-net --name db postgres\n# Now \"api\" and \"db\" resolve to each other\n```\n\n### Capture network traffic\n\n```bash\n# tcpdump inside a container\ndocker exec my-container tcpdump -i eth0 -n port 8080\n\n# If tcpdump not available, use a sidecar\ndocker run --rm --net=container:my-container nicolaka\u002Fnetshoot tcpdump -i eth0 -n\n\n# netshoot has: tcpdump, curl, nslookup, netstat, iperf, etc.\ndocker run --rm --net=container:my-container nicolaka\u002Fnetshoot bash\n```\n\n## Resource Usage\n\n### Real-time stats\n\n```bash\n# All containers\ndocker stats\n\n# Specific containers\ndocker stats api db redis\n\n# One-shot (no streaming)\ndocker stats --no-stream\n\n# Formatted output\ndocker stats --format \"table {{.Name}}\\t{{.CPUPerc}}\\t{{.MemUsage}}\\t{{.NetIO}}\"\n```\n\n### Memory investigation\n\n```bash\n# Check memory limit\ndocker inspect --format='{{.HostConfig.Memory}}' my-container\n# 0 means unlimited\n\n# Check if container was OOM-killed\ndocker inspect --format='{{.State.OOMKilled}}' my-container\n\n# Memory usage breakdown (Linux cgroups)\ndocker exec my-container cat \u002Fsys\u002Ffs\u002Fcgroup\u002Fmemory.current 2>\u002Fdev\u002Fnull || \\\ndocker exec my-container cat \u002Fsys\u002Ffs\u002Fcgroup\u002Fmemory\u002Fmemory.usage_in_bytes\n\n# Process memory inside container\ndocker exec my-container ps aux --sort=-%mem | head -10\ndocker exec my-container top -bn1\n```\n\n### Disk usage\n\n```bash\n# Overall Docker disk usage\ndocker system df\ndocker system df -v\n\n# Container filesystem size\ndocker inspect --format='{{.SizeRw}}' my-container\n\n# Find large files inside container\ndocker exec my-container du -sh \u002F* 2>\u002Fdev\u002Fnull | sort -rh | head -10\ndocker exec my-container find \u002Ftmp -size +10M -type f\n\n# Check for log file bloat\ndocker exec my-container ls -lh \u002Fvar\u002Flog\u002F\n```\n\n## Dockerfile Debugging\n\n### Multi-stage build debugging\n\n```bash\n# Build up to a specific stage\ndocker build --target builder -t my-app:builder .\n\n# Inspect what's in the builder stage\ndocker run --rm -it my-app:builder sh\ndocker run --rm my-app:builder ls -la \u002Fapp\u002F\ndocker run --rm my-app:builder cat \u002Fapp\u002Fpackage.json\n\n# Check which files made it to the final image\ndocker run --rm my-image ls -laR \u002Fapp\u002F\n\n# Build with no cache (fresh build)\ndocker build --no-cache -t my-app .\n\n# Build with progress output\ndocker build --progress=plain -t my-app .\n```\n\n### Image inspection\n\n```bash\n# Show image layers (size of each)\ndocker history my-image\ndocker history --no-trunc my-image\n\n# Inspect image config (entrypoint, cmd, env, ports)\ndocker inspect my-image | jq '.[0].Config | {Cmd, Entrypoint, Env, ExposedPorts, WorkingDir}'\n\n# Compare two images\ndocker history image-a --format \"{{.Size}}\\t{{.CreatedBy}}\" > layers-a.txt\ndocker history image-b --format \"{{.Size}}\\t{{.CreatedBy}}\" > layers-b.txt\ndiff layers-a.txt layers-b.txt\n\n# Find what changed between builds\ndocker diff my-container\n# A = added, C = changed, D = deleted\n```\n\n## Health Checks\n\n### Define and debug health checks\n\n```dockerfile\n# In Dockerfile\nHEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \\\n  CMD curl -f http:\u002F\u002Flocalhost:8080\u002Fhealth || exit 1\n```\n\n```bash\n# Check health status\ndocker inspect --format='{{.State.Health.Status}}' my-container\n# \"healthy\", \"unhealthy\", or \"starting\"\n\n# See health check log (last 5 results)\ndocker inspect --format='{{json .State.Health}}' my-container | jq\n\n# Run health check manually\ndocker exec my-container curl -f http:\u002F\u002Flocalhost:8080\u002Fhealth\n\n# Override health check at run time\ndocker run --health-cmd \"curl -f http:\u002F\u002Flocalhost:8080\u002Fhealth || exit 1\" \\\n           --health-interval 10s my-image\n\n# Disable health check\ndocker run --no-healthcheck my-image\n```\n\n## Docker Compose Debugging\n\n### Service startup issues\n\n```bash\n# Check service status\ndocker compose ps\n\n# See why a service failed\ndocker compose logs failed-service\n\n# Start with verbose output\ndocker compose up --build 2>&1 | tee compose.log\n\n# Start a single service (with dependencies)\ndocker compose up db\n\n# Start without dependencies\ndocker compose up --no-deps api\n\n# Recreate containers from scratch\ndocker compose up --force-recreate --build\n\n# Check effective config (after variable substitution)\ndocker compose config\n```\n\n### Service dependency and startup order\n\n```yaml\n# docker-compose.yml\nservices:\n  api:\n    depends_on:\n      db:\n        condition: service_healthy\n      redis:\n        condition: service_started\n\n  db:\n    image: postgres:16\n    healthcheck:\n      test: [\"CMD-SHELL\", \"pg_isready -U postgres\"]\n      interval: 5s\n      timeout: 5s\n      retries: 5\n\n  redis:\n    image: redis:7\n    healthcheck:\n      test: [\"CMD\", \"redis-cli\", \"ping\"]\n      interval: 5s\n      timeout: 5s\n      retries: 5\n```\n\n```bash\n# Wait for a service to be healthy before running commands\ndocker compose up -d db\ndocker compose exec db pg_isready  # Polls until ready\ndocker compose up -d api\n```\n\n## Cleanup\n\n```bash\n# Remove stopped containers\ndocker container prune\n\n# Remove unused images\ndocker image prune\n\n# Remove everything unused (containers, images, networks, volumes)\ndocker system prune -a\n\n# Remove volumes too (WARNING: deletes data)\ndocker system prune -a --volumes\n\n# Remove dangling build cache\ndocker builder prune\n```\n\n## Tips\n\n- `docker logs -f` is the first thing to check. Most container failures are visible in the logs.\n- Exit code 137 means OOM-killed. Increase the memory limit or fix the memory leak.\n- Apps inside containers must bind to `0.0.0.0`, not `127.0.0.1`. Localhost inside a container is isolated.\n- Container names only resolve via DNS on user-defined networks, not the default `bridge`. Always create a custom network for multi-container setups.\n- `docker exec` only works on running containers. For crashed containers, use `docker cp` to extract logs or override the entrypoint with `docker run --entrypoint sh`.\n- `nicolaka\u002Fnetshoot` is the Swiss Army knife for container networking. It has every networking tool pre-installed.\n- `--progress=plain` during builds shows full command output, which is essential for debugging build failures.\n- Health checks with `start-period` prevent false unhealthy status during slow application startup.\n",{"name":5,"metadata":43,"description":7},{"clawdbot":44},{"os":45,"emoji":46,"requires":47},[36,22,33],"?",{"bins":48},[37],"main","f4cb2d49f7667e79ef7804f50396d5aaffdf1f56","DevOps与云计算\u002Fcontainer-debug",1,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification","https:\u002F\u002Fgithub.com\u002FKernel8901","a little little little dobe in life but science geek","2026-04-05 16:43:56",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add Kernel8901\u002Fai-agent-skills-classification --skill container-debug",{"tool":63,"command":64},"bunx","bunx skills add Kernel8901\u002Fai-agent-skills-classification --skill container-debug",{"tool":66,"command":67},"pnpm","pnpm dlx skills add Kernel8901\u002Fai-agent-skills-classification --skill container-debug","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002FDevOps与云计算\u002Fcontainer-debug\u002FSKILL.md",true,[71],{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":75,"sourceHtmlUrl":76},"_meta.json","REFERENCE","参考文档",294,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002FDevOps与云计算\u002Fcontainer-debug\u002F_meta.json",[78,101,124,132,139,166],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":38},"01M6Q5R6WZ06RRB9RQTW54B34B","zyfai","Earn yield on any Ethereum wallet on Base, Arbitrum, and Plasma. Use when a user wants passive DeFi yield on their funds. Deploys a non-custodial subaccount (Safe) linked to their EOA, enables automated yield optimization, and lets them deposit\u002Fwithdraw anytime.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzyfai-sdk\u002FSKILL.md",[],[80,85,86,87,88,89,28,90,91,92,93,94,95,96,97,98,99,100],"safe","ethereum","defi","Optimization","user","Wallet","base","deposit","withdraw","yield","arbitrum","non-custodial","passive","defi yield","earn","yield optimization",{"skillNo":102,"name":103,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":38},"01M6Q5R337B5JSNER4P4YS03TN","zerion-api","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api\u002FSKILL.md",[],[107,108,109,110,111,112,113,87,114,90,115,116,117,118,119,120,121,122,123],"api","zerion api","zerion","MCP","mcp server","server","blockchain","transactions","crypto wallet","crypto","evm","solana","query","across","positions","token","prices",{"skillNo":125,"name":126,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":129,"publishedAt":38},"01M6Q5QZFYTDAZMZ27BN5VZXAR","zerion-api-skill","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api-skill\u002FSKILL.md",[],[107,130,131,108,109,110,111,112,113,87,114,90,116,117,118,119,120,121,122,123],"api skill","zerion api skill",{"skillNo":133,"name":134,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":38},"01M6Q5QW17QW98RA3FE45E4RD8","zerion-api-mcp","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api-mcp\u002FSKILL.md",[],[110,107,138,108,109,111,112,87,114,90,115,116,117,118,119,120,121,122,123],"zerion api mcp",{"skillNo":140,"name":141,"nameZh":6,"description":142,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":143,"categories":144,"keywords":145,"publishedAt":38},"01M6Q5QQYZB7A501BDEQWKGSJT","yahoo-finance-forex","Fetches real-time FOREX news and market data from Yahoo Finance for major currency pairs (EUR\u002FUSD, GBP\u002FUSD, USD\u002FJPY, etc.). Analyzes sentiment and provides trading context.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fyahoo-finance-forex\u002FSKILL.md",[],[146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165],"finance","yahoo finance","forex","yahoo","yahoo finance forex","github","https","sentiment","real-time","python3","install","Market","usd","news","time","currency","gbp","pip","market data","for",{"skillNo":167,"name":168,"nameZh":6,"description":169,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":170,"categories":171,"keywords":172,"publishedAt":38},"01M6Q5QM6VS84WZVM7BKXXPF32","yahoo-finance","This skill should be used when the user asks to \"get stock prices\", \"check stock quotes\", \"look up earnings\", \"get financial data\", \"find trending stocks\", or needs stock market data from Yahoo Finance.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fyahoo-finance-cli\u002FSKILL.md",[],[146,147,149,173,174,175,176,177,178,157,179,180,181,182,183,184,185,186,123,164],"cli","homebrew","find","check","brew","up","local","get","stock","link","trending","sf","quotes","ln"]