docker-expert

Diagnoses and optimizes Dockerfiles, container security, and Docker Compose orchestration configurations.

3|1|Updated Nov 30, 2025
One-click install
npx skills add https://github.com/PALabs-v1/AI_friend --skill docker-expert-palabs-v1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docker-expert
Source: https://github.com/PALabs-v1/AI_friend/tree/main/.agents/skills/docker-expert
Command: npx skills add https://github.com/PALabs-v1/AI_friend --skill docker-expert-palabs-v1

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Container builds that are slow, images that are bloated, security scans that fail, and Compose services that won't communicate are common Docker pain points. This Skill analyzes your container setup and applies proven optimization, hardening, and orchestration patterns to fix them. ## Core Features & Use Cases - Dockerfile Optimization: Applies multi-stage builds, layer caching strategies, and base image selection (Alpine, distroless, scratch) to reduce image size and build time. - Security Hardening: Configures non-root users, secrets management via BuildKit mounts, and minimal attack surfaces to pass security scans. - Compose Orchestration: Designs production-grade docker-compose setups with health checks, service dependencies, custom networks, and resource limits. - Use Case: Your Node.js image is 1.2GB and builds take 10 minutes. The Skill restructures it into a multi-stage build with dependency caching and a distroless runtime, cutting size and build time dramatically. ## Quick Start Ask the AI to review my Dockerfile and docker-compose.yml for size optimization, security issues, and production readiness.

Frequently Asked Questions about docker-expert

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce Docker image size with multi-stage builds?

Multi-stage builds separate dependency installation, compilation, and runtime into distinct stages, copying only necessary artifacts into the final image. Combining this with distroless or Alpine base images and cleaning package manager caches in the same RUN layer significantly reduces size.

How to run Docker containers as a non-root user?

Create a dedicated user with a specific UID/GID using addgroup and adduser, then set the USER directive before CMD. Copy files with --chown so the runtime user owns application files, and avoid installing unnecessary packages to limit attack surface.

Why is my Docker build so slow?

Slow builds usually come from poor layer ordering, large build contexts, or missing cache strategy. Copy dependency manifests before source code, add a comprehensive .dockerignore, and use BuildKit cache mounts for package managers like npm.

Does Docker Compose support service health checks and startup ordering?

Yes. Define a healthcheck block with test, interval, timeout, and retries, then use depends_on with condition: service_healthy so dependent services wait until the dependency is actually ready rather than just started.

How do I manage secrets in Docker builds without leaking them?

Use BuildKit secret mounts (--mount=type=secret) for build-time secrets and Docker secrets files for runtime, instead of ENV variables or ARG values which persist in image layers and history.

When should I use Kubernetes instead of Docker Compose?

Compose suits single-host development and small deployments. When you need multi-node orchestration, autoscaling, ingress management, or pod-level scheduling, this Skill recommends switching to a Kubernetes-focused approach instead.