Docker Build

Docker image building best practices including multi-stage builds, layer optimization, and security hardening. Use when creating Dockerfiles, optimizing image size, or debugging container builds.

43 stars 9 forksDevOps & CloudOfficial

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add aws-samples/sample-kiro-cli-multiagent-development --skill docker-build
Manual install
git clone --depth 1 https://github.com/aws-samples/sample-kiro-cli-multiagent-development.git /tmp/sample-kiro-cli-multiagent-development
mkdir -p ~/.claude/skills
cp -r /tmp/sample-kiro-cli-multiagent-development/skills/docker-build ~/.claude/skills/docker-build

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Docker Build

## Multi-Stage Build Pattern

```dockerfile
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build

# Runtime stage
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
USER node
EXPOSE 3000
CMD ["node", "dist/index.js"]
```

## Layer Optimization

1. Order instructions from least to most frequently changing
2. Combine RUN commands to reduce layers
3. Use `.dockerignore` to exclude unnecessary files
4. Pin base image versions (not `latest`)

```dockerfile
# Good: combined and ordered
COPY package*.json ./
RUN npm ci && npm cache clean --force
COPY . .

# Bad: separate commands, poor ordering
RUN npm install
COPY . .
```

## Security Hardening

- Run as non-root user: `USER node` or `USER 1000`
- Use minimal base images: `alpine`, `distroless`, `scratch`
- Don't store secrets in images — use runtime injection
- Scan images: `docker scout`, `trivy`, `grype`

## Debugging

```bash
# Build with progress output
docker build --progress=plain -t myapp .

# Inspect intermediate layers
docker history myapp

# Run shell in failed build
docker run -it --entrypoint sh <image-id>

# Check image size breakdown
docker images --format "{{.Repository}}:{{.Tag}} {{.Size}}"
```
Read the full skill on GitHub

Details

Skill name
docker-build
Path
skills/docker-build/SKILL.md
License
MIT-0
Repo updated
9 September 2026

FAQ

What does the Docker Build skill do?

Docker image building best practices including multi-stage builds, layer optimization, and security hardening. Use when creating Dockerfiles, optimizing image size, or debugging container builds.

How do I install the Docker Build skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add aws-samples/sample-kiro-cli-multiagent-development --skill docker-build. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Docker Build popular?

It lives in aws-samples/sample-kiro-cli-multiagent-development, which has 43 GitHub stars and 9 forks.

Related skills

Agentcore Patterns

43

aws-samples/sample-kiro-cli-multiagent-development

Verified Amazon Bedrock AgentCore patterns for Runtime handlers, Gateway MCP clients with SigV4/IAM auth, Memory session management with Strands, and Bedrock cross-region inference-profile IAM policies. Use when building or debugging AgentCore-based agents.

AI, LLMs & Agents

AWS Technical Docs

43

aws-samples/sample-kiro-cli-multiagent-development

AWS technical documentation patterns covering procedures, lists, tables, titles, error messages, and content patterns. Use when writing AWS service documentation, procedures, troubleshooting guides, tutorials, or getting started content.

Writing & Content

CLI Execution

43

aws-samples/sample-kiro-cli-multiagent-development

CLI execution best practices covering RTK token compression, AWS discover-then-execute patterns, output control, and bash/zsh scripting with logging. Use when running CLI commands, querying AWS resources, writing automation scripts, or working with shell tooling.

Software Development

Iac Verification

43

aws-samples/sample-kiro-cli-multiagent-development

Strong validation commands for infrastructure-as-code (CDK, CloudFormation, Terraform, Docker, Kubernetes) plus mandatory post-deploy smoke tests. Use when verifying IaC changes before marking a task complete, or when authoring or modifying a deploy script — render and validate the actual output, never just lint or cat the file.

DevOps & Cloud

Al Build

115

javiarmesto/ALDC-AL-Development-Collection

Build, package, and deploy AL extensions to Business Central environments.

DevOps & Cloud36

Jenkins Deploy Skill

45

maimingliang/jenkins-deploy-skill

Use this skill whenever the user mentions deploying, pushing to Jenkins, triggering a build, or merging to a deploy branch such as dev, test, or pre. It automates "merge -> push -> Jenkins build" with secure credential handling across Windows, macOS, and Linux, and supports both legacy single-project and multi-project config layouts. Invoke it for requests like "帮我部署", "push 到 test 环境", "deploy pre", "发布 demo-admin 的 test 环境", or "触发 Jenkins 构建".

DevOps & Cloud

Browse the most popular Claude skills, all devops & cloud skills, or write your own with the skills generator.