Generates and optimizes Dockerfiles for project containerization.

Install

mkdir -p .claude/skills/docker-build && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16237" && unzip -o skill.zip -d .claude/skills/docker-build && rm skill.zip

Installs to .claude/skills/docker-build

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Creates or optimizes a Dockerfile for the current project
57 charsno explicit “when” trigger
Beginner

Key capabilities

  • Detect project type for Dockerfile generation
  • Review existing Dockerfiles for best practices
  • Generate new Dockerfiles following multi-stage build patterns
  • Create or update `.dockerignore` files
  • Show `docker build` and `docker run` commands
  • Optimize image size

How it works

The skill detects the project type, reviews existing Dockerfiles for best practices, or generates a new multi-stage Dockerfile and a `.dockerignore` file, then provides build and run commands.

Inputs & outputs

You give it
Current project directory
You get back
Optimized Dockerfile and `.dockerignore` file

When to use docker-build

  • Creating new Dockerfiles
  • Optimizing container build stages
  • Configuring .dockerignore

About this skill

Docker Setup

  1. Detect project type:
cat package.json 2>/dev/null | grep '"main"\|"start"\|"scripts"' -A 5
ls -la | grep -E "Dockerfile|docker-compose|\.dockerignore"
  1. If Dockerfile exists, review it for:

    • Multi-stage build (build stage vs runtime stage)
    • Layer caching order (dependencies before source)
    • Running as non-root user
    • .dockerignore completeness
    • Image size optimization
  2. If no Dockerfile, generate one following best practices:

# Multi-stage: build → runtime
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production

FROM node:20-alpine AS runtime
RUN addgroup -S app && adduser -S app -G app
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY . .
USER app
EXPOSE 3000
CMD ["node", "dist/index.js"]
  1. Also create/update .dockerignore:
node_modules
dist
.env*
.git
coverage
*.test.*
  1. Show docker build and docker run commands to test.

When not to use it

  • When the user does not want a multi-stage build
  • When the user does not want a non-root user in the container
  • When the user does not want to optimize image size

Limitations

  • Assumes common project structures for detection.
  • Generated Dockerfiles follow specific multi-stage patterns.
  • `.dockerignore` content is based on common exclusions.

How it compares

This skill automates the creation and optimization of Dockerfiles and `.dockerignore` files based on project type and best practices, which is more efficient than manual configuration.

Compared to similar skills

docker-build side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
docker-build (this skill)04moReviewBeginner
docker-expert116moReviewIntermediate
deployment-engineer44moNo flagsAdvanced
devops27moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

docker-expert

davila7

Docker containerization expert with deep knowledge of multi-stage builds, image optimization, container security, Docker Compose orchestration, and production deployment patterns. Use PROACTIVELY for Dockerfile optimization, container issues, image size problems, security hardening, networking, and orchestration challenges.

1135

deployment-engineer

sickn33

Expert deployment engineer specializing in modern CI/CD pipelines, GitOps workflows, and advanced deployment automation. Masters GitHub Actions, ArgoCD/Flux, progressive delivery, container security, and platform engineering. Handles zero-downtime deployments, security scanning, and developer experience optimization. Use PROACTIVELY for CI/CD design, GitOps implementation, or deployment automation.

418

devops

mrgoonie

Deploy to Cloudflare (Workers, R2, D1), Docker, GCP (Cloud Run, GKE), Kubernetes (kubectl, Helm). Use for serverless, containers, CI/CD, GitOps, security audit.

216

ecs

itsmostafa

AWS ECS container orchestration for running Docker containers. Use when deploying containerized applications, configuring task definitions, setting up services, managing clusters, or troubleshooting container issues.

215

add-install-docker-ci-e2e

RLinf

Adds install command in install script, Docker build stage in Dockerfile, and CI jobs for docker build, install script, and embodied e2e test when introducing a new model or environment in RLinf. Use when adding a new embodied model (e.g. dexbotic), new env (e.g. maniskill_libero), or new model+env combination that should be installable, dockerized, and tested in CI.

16

devcontainer-management

netalertx

Guide for identifying, managing, and running commands within the NetAlertX development container. Use this when asked to run commands, testing, setup scripts, or troubleshoot container issues.

13

Search skills

Search the agent skills registry