| name | docker-ops |
| description | Docker container operations and debugging |
| homepage | https://docs.docker.com/ |
| metadata | {"emoji":"🐳","version":"1.0.0","author":"Gourav Shah","license":"MIT","requires":{"bins":["docker"]},"tags":["docker","containers","debugging"]} |
Docker Operations
Quick reference for Docker container management and debugging.
When to Use This Skill
Use this skill when:
- Managing Docker containers
- Debugging container issues
- Checking container logs
- Cleaning up Docker resources
- Inspecting container state
Quick Status Commands
List Containers
docker ps
docker ps -a
docker ps -s
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
Container Logs
docker logs <container>
docker logs -f <container>
docker logs --tail 100 <container>
docker logs -t <container>
docker logs --since 1h <container>
Resource Usage
docker stats
docker stats --no-stream
docker stats <container>
Container Management
Start/Stop/Restart
docker start <container>
docker stop <container>
docker restart <container>
docker kill <container>
Execute Commands
docker exec <container> <command>
docker exec -it <container> /bin/sh
docker exec -it <container> /bin/bash
docker exec -u root -it <container> /bin/sh
Inspect Container
docker inspect <container>
docker inspect -f '{{.State.Status}}' <container>
docker inspect -f '{{.NetworkSettings.IPAddress}}' <container>
docker inspect -f '{{json .Config.Env}}' <container>
Image Management
List Images
docker images
docker images --digests
docker images -f "dangling=true"
Pull/Push
docker pull <image>:<tag>
docker push <image>:<tag>
Cleanup Commands
Safe Cleanup
docker container prune -f
docker image prune -f
docker volume prune -f
docker network prune -f
docker system prune -f
Check Disk Usage
docker system df
docker system df -v
Debugging
Container Not Starting
docker inspect -f '{{.State.Status}}' <container>
docker inspect -f '{{.State.Error}}' <container>
docker logs <container>
docker events --since 1h --filter container=<container>
Network Issues
docker network ls
docker network inspect <network>
docker inspect -f '{{json .NetworkSettings.Networks}}' <container>
docker exec <container> ping -c 3 <host>
docker exec <container> curl -v <url>
Resource Issues
docker inspect -f '{{.HostConfig.Memory}}' <container>
docker inspect -f '{{.HostConfig.CpuShares}}' <container>
docker stats <container> --no-stream
Common Patterns
Run One-Off Command
docker run --rm <image> <command>
docker run --rm alpine cat /etc/alpine-release
Copy Files
docker cp <container>:/path/to/file ./local/path
docker cp ./local/file <container>:/path/in/container
View Container Processes
docker top <container>
Quick Troubleshooting
| Symptom | Check | Fix |
|---|
| Container exits immediately | docker logs <container> | Fix application error |
| Can't connect to container | docker inspect network | Check port mapping |
| Container slow | docker stats | Increase resources |
| Disk full | docker system df | docker system prune |
| Image pull fails | Network/auth | Check registry access |
Related Skills
- k8s-debug: For Kubernetes container debugging
- log-analysis: For log pattern analysis