docker-best-practices

Enforce Dockerfile best practices for secure, optimized images.

34|5|Updated Jan 25, 2026
One-click install
npx skills add https://github.com/baekenough/oh-my-customcode --skill docker-best-practices-baekenough
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docker-best-practices
Source: https://github.com/baekenough/oh-my-customcode/tree/main/templates/.claude/skills/docker-best-practices
Command: npx skills add https://github.com/baekenough/oh-my-customcode --skill docker-best-practices-baekenough

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Docker builds often produce bloated, insecure images due to inconsistent patterns. This Skill guides developers to apply proven Dockerfile practices to produce smaller, safer containers.

Core Features & Use Cases

  • Multi-stage builds to minimize final image size and separate build tools from runtime
  • Non-root users, pinned base images, and minimal base layers to improve security and reproducibility
  • Cache-aware layering and .dockerignore usage to speed up builds and reduce artifacts
  • Guidance for integrating security scanning and image-size reduction into CI/CD pipelines

Quick Start

Update your Dockerfile to apply multi-stage builds and non-root user practices, then validate the resulting image size and security posture.

Frequently Asked Questions about docker-best-practices

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

FAQPage Schema
How do I make Docker images smaller using multi-stage builds?

Multi-stage builds minimize Docker image size by copying only runtime artifacts from a builder stage into a minimal final image, separating build tools from the production runtime to produce lean containers.

Why are my Docker images insecure and how can I fix reproducibility?

Docker images become insecure without non-root users and pinned base images. Enforcing minimal base layers and pinned tags improves security and ensures reproducible image builds across pipelines.

What is the best way to speed up Docker build pipelines?

Cache-aware layering and proper .dockerignore usage speed up Docker builds by optimizing layer reuse and reducing build context artifacts, resulting in faster CI/CD pipeline execution.

Can I integrate Docker security scanning and image optimization into CI/CD pipelines?

Yes, you can integrate security scanning and image-size reduction into CI/CD pipelines by applying consistent Dockerfile patterns, ensuring automated validation of image security posture and size.

Does BuildKit work with cache-aware layering for Docker containers?

BuildKit supports cache-aware layering patterns for Docker containers, enabling efficient layer reuse during builds to reduce build times and generate optimized images.