agentic-in/elephant-agent/docker-management
Claude Code and agent skill by agentic-in/elephant-agent
- community
Checking that the SKILL.md file is still in the repository.
Manage Docker containers, images, volumes, networks, and Compose stacks — lifecycle ops, debugging, cleanup, and Dockerfile optimization.
Install
npx vskill@latest install agentic-in/elephant-agent/docker-managementSKILL.md
Docker Management
Manage Docker containers, images, volumes, networks, and Compose stacks using standard Docker CLI commands. No additional dependencies beyond Docker itself.
When to Use
- Run, stop, restart, remove, or inspect containers
- Build, pull, push, tag, or clean up Docker images
- Work with Docker Compose (multi-service stacks)
- Manage volumes or networks
- Debug a crashing container or analyze logs
- Check Docker disk usage or free up space
- Review or optimize a Dockerfile
Prerequisites
- Docker Engine installed and running
- User added to the
dockergroup (or usesudo) - Docker Compose v2 (included with modern Docker installations)
Quick check:
Quick Reference
| Task | Command | |
|---|---|---|
| Run container (background) | docker run -d --name NAME IMAGE | |
| Stop + remove | docker stop NAME && docker rm NAME | |
| View logs (follow) | docker logs --tail 50 -f NAME | |
| Shell into container | docker exec -it NAME /bin/sh | |
| List all containers | docker ps -a | |
| Build image | docker build -t TAG . | |
| Compose up | docker compose up -d | |
| Compose down | docker compose down | |
| Disk usage | docker system df | |
| Cleanup dangling | docker image prune && docker container prune |
Procedure
1. Identify the domain
Figure out which area the request falls into:
- Container lifecycle → run, stop, start, restart, rm, pause/unpause
- Container interaction → exec, cp, logs, inspect, stats
- Image management → build, pull, push, tag, rmi, save/load
- Docker Compose → up, down, ps, logs, exec, build, config
- Volumes & networks → create, inspect, rm, prune, connect
- Troubleshooting → log analysis, exit codes, resource issues
2. Container operations
Run a new container:
Key flags: -d detached, -it interactive+tty, --rm auto-remove, -p port (host:container), -e env var, -v volume, --name name, --restart restart policy.
Manage running containers:
Interact with containers:
3. Image management
4. Docker Compose
Minimal compose.yml example:
5. Volumes and networks
6. Disk usage and cleanup
Always start with a diagnostic before cleaning:
Warning: Never run docker system prune -a --volumes without confirming with the user. This removes named volumes with potentially important data.
Pitfalls
| Problem | Cause | Fix | |
|---|---|---|---|
| Container exits immediately | Main process finished or crashed | Check docker logs NAME, try docker run -it --entrypoint /bin/sh IMAGE | |
| "port is already allocated" | Another process using that port | docker ps or lsof -i :PORT to find it | |
| "no space left on device" | Docker disk full | docker system df then targeted prune | |
| Can't connect to container | App binds to 127.0.0.1 inside container | App must bind to 0.0.0.0, check -p mapping | |
| Permission denied on volume | UID/GID mismatch host vs container | Use --user $(id -u):$(id -g) or fix permissions | |
| Compose services can't reach each other | Wrong network or service name | Services use service name as hostname, check docker compose config | |
| Build cache not working | Layer order wrong in Dockerfile | Put rarely-changing layers first (deps before source code) | |
| Image too large | No multi-stage build, no .dockerignore | Use multi-stage builds, add .dockerignore |
Verification
After any Docker operation, verify the result:
- Container started? →
docker ps(check status is "Up") - Logs clean? →
docker logs --tail 20 NAME(no errors) - Port accessible? →
curl -s http://localhost:PORTordocker port NAME - Image built? →
docker images | grep TAG - Compose stack healthy? →
docker compose ps(all services "running" or "healthy") - Disk freed? →
docker system df(compare before/after)
Dockerfile Optimization Tips
When reviewing or creating a Dockerfile, suggest these improvements:
- Multi-stage builds — separate build environment from runtime to reduce final image size
- Layer ordering — put dependencies before source code so changes don't invalidate cached layers
- Combine RUN commands — fewer layers, smaller image
- Use .dockerignore — exclude
node_modules,.git,__pycache__, etc. - Pin base image versions —
node:20-alpinenotnode:latest - Run as non-root — add
USERinstruction for security - Use slim/alpine bases —
python:3.12-slimnotpython:3.12
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpackages/skills/builtin_packages/devops/docker-management/SKILL.md
Popularity
- Repository stars
- 564
- Repository forks
- 59
- 7-day trend score
- 32
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/agentic-in/elephant-agent/docker-management)