<< All versions
Skill v1.0.1
currentAutomated scan100/100onewave-ai/claude-skills/docker-debugger
1 files
──Details
PublishedAugust 18, 2026 at 11:46 AM
Content Hashsha256:a4a4d766048c82bc...
Git SHA82859c0ebaff
Bump Typepatch
──Files
Files (1 file, 3.1 KB)
SKILL.md3.1 KBactive
SKILL.md · 171 lines · 3.1 KB
version: "1.0.1" name: docker-debugger description: Debug Docker containers, fix Dockerfile issues, optimize images, and troubleshoot docker-compose. Use when having Docker problems, container issues, or optimizing Docker builds.
Docker Debugger
Instructions
When debugging Docker issues:
- Identify the problem type: Build, runtime, networking, or performance
- Gather information using diagnostic commands
- Analyze logs and errors
- Apply fixes
Diagnostic Commands
bash
# Check running containersdocker ps -a# View container logsdocker logs <container_id> --tail 100 -f# Inspect containerdocker inspect <container_id># Check resource usagedocker stats# View container processesdocker top <container_id># Execute shell in running containerdocker exec -it <container_id> /bin/sh# Check Docker disk usagedocker system df# View build historydocker history <image_name>
Common Issues & Solutions
1. Container exits immediately
bash
# Check exit codedocker inspect <container_id> --format='{{.State.ExitCode}}'# View last logsdocker logs <container_id>
Fixes:
- Ensure CMD/ENTRYPOINT runs a foreground process
- Check for missing dependencies
- Verify environment variables
2. Build fails
dockerfile
# Use multi-stage builds for smaller imagesFROM node:20-alpine AS builderWORKDIR /appCOPY package*.json ./RUN npm ciCOPY . .RUN npm run buildFROM node:20-alpine AS runnerWORKDIR /appCOPY --from=builder /app/dist ./distCOPY --from=builder /app/node_modules ./node_modulesCMD ["node", "dist/index.js"]
3. Networking issues
bash
# List networksdocker network ls# Inspect networkdocker network inspect <network_name># Check container IPdocker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container>
4. Volume permission issues
dockerfile
# Create non-root userRUN addgroup -g 1001 -S appgroup && \adduser -u 1001 -S appuser -G appgroup# Set ownershipCOPY --chown=appuser:appgroup . .USER appuser
Dockerfile Best Practices
dockerfile
# 1. Use specific tags, not :latestFROM node:20.10-alpine# 2. Set working directoryWORKDIR /app# 3. Copy dependency files first (better caching)COPY package*.json ./RUN npm ci --only=production# 4. Copy source after dependenciesCOPY . .# 5. Use non-root userUSER node# 6. Set proper labelsLABEL maintainer="you@example.com"LABEL version="1.0"# 7. Use HEALTHCHECKHEALTHCHECK --interval=30s --timeout=3s \CMD wget -q --spider http://localhost:3000/health || exit 1# 8. Expose portsEXPOSE 3000# 9. Use exec form for CMDCMD ["node", "server.js"]
docker-compose Debugging
yaml
# docker-compose.ymlservices:app:build:context: .dockerfile: Dockerfile# Add for debuggingstdin_open: truetty: true# Override command for debuggingcommand: /bin/shvolumes:- .:/appenvironment:- DEBUG=true
bash
# Rebuild without cachedocker-compose build --no-cache# View logsdocker-compose logs -f app# Restart single servicedocker-compose restart app