home / skills / jackspace / claudeskillz / docker-helper

docker-helper skill

/skills/docker-helper

This skill helps you manage and optimize Docker environments with practical commands, best practices, and configurations for containers, images, and

npx playbooks add skill jackspace/claudeskillz --skill docker-helper

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
1.1 KB
---
name: docker-helper
description: Expert helper for Docker containers, Docker Compose, and container optimization
---

# Docker-helper

## Instructions

When helping with Docker tasks:
1. Check running containers: docker ps -a
2. View logs: docker logs -f <container>
3. Inspect container: docker inspect <container>
4. Execute commands: docker exec -it <container> /bin/bash
- Use multi-stage builds to reduce image size
- Order Dockerfile commands by frequency of change
- Use .dockerignore to exclude unnecessary files
- Avoid running as root; create non-privileged users
- Use health checks in docker-compose
- Networking: Check bridge networks and port mappings
- Volumes: Verify volume mounts and permissions
- Build cache: Use --no-cache when needed
- Resource limits: Set memory/CPU limits appropriately
- Use version 3+ syntax
- Leverage environment files (.env)
- Use depends_on with health checks
- Implement restart policies


## Examples

Add examples of how to use this skill here.

## Notes

- This skill was auto-generated
- Edit this file to customize behavior

Overview

This skill is an expert helper for Docker containers, Docker Compose, and container optimization. It provides practical troubleshooting steps, best-practice recommendations for Dockerfiles and compose files, and actionable checks for running systems. Use it to speed up debugging, reduce image size, and harden container deployments.

How this skill works

The skill walks through common inspection and remediation commands (container listing, logs, inspect, exec) and suggests targeted fixes based on findings. It recommends build-time and runtime optimizations like multi-stage builds, .dockerignore usage, non-root users, health checks, and resource limits. It also guides compose-level checks for networks, volumes, environment files, and restart/depends_on behavior.

When to use it

  • Diagnosing failing containers or services that crash on start
  • Optimizing Dockerfile and image size before production builds
  • Verifying volume mounts, file permissions, and persistent data issues
  • Setting up or hardening Docker Compose deployments with health checks
  • Troubleshooting networking issues, port mappings, and bridge networks

Best practices

  • Start with docker ps -a, docker logs -f, docker inspect, and docker exec -it to gather evidence
  • Use multi-stage builds and order Dockerfile layers by change frequency to leverage cache
  • Add a .dockerignore to exclude unnecessary files and reduce build context
  • Avoid running processes as root; create and switch to a non-privileged user
  • Add healthcheck blocks, resource limits (memory/CPU), and restart policies in Compose
  • Use .env files for configuration and depends_on with health checks for service ordering

Example use cases

  • Shrink a bloated Python image by converting to a multi-stage build and removing dev artifacts
  • Fix a web service that fails behind Compose by inspecting logs, validating port mappings, and checking network bridges
  • Recover a container with a blocked volume by checking mount paths, permissions, and restarting with corrected binds
  • Add health checks and restart policies to a Compose stack to ensure automatic recovery of flaky services
  • Identify why build cache is stale and force a clean build with --no-cache when reproducing failures

FAQ

What first command should I run when a container is failing?

Start with docker ps -a to find the container, then docker logs -f <container> for runtime errors and docker inspect <container> for configuration details.

How do I reduce Docker image size quickly?

Use multi-stage builds, remove build tools and caches in the final stage, minimize layers, and add a .dockerignore to trim the build context.