Build production-ready Docker containers following best practices for security, performance, and maintainability.
When to Use
Containerizing applications for deployment
Creating Dockerfiles for new services
Optimizing existing container images
Setting up development environments
Building CI/CD container pipelines
Implementing microservices
Quick Start
Minimal working example:
# Multi-stage build for Node.js application
# Stage 1: Build
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
# Stage 2: Production
FROM node:18-alpine
WORKDIR /app
# Copy only production dependencies and built files
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY package*.json ./
# Security: Run as non-root user
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
USER nodejs
EXPOSE 3000
CMD ["node", "dist/index.js"]
Reference Guides
Detailed implementations in the references/ directory:
Guide
Contents
Multi-Stage Builds
Multi-Stage Builds
Optimization Techniques
Optimization Techniques
Security Best Practices
Security Best Practices, Environment Configuration
Docker Compose for Multi-Container
Docker Compose for Multi-Container
.dockerignore File
.dockerignore File
Python
Python (Django/Flask), Java (Spring Boot), Go
Best Practices
✅ DO
Use official base images
Implement multi-stage builds
Run as non-root user
Use .dockerignore
Pin specific versions
Include health checks
Scan for vulnerabilities
Minimize layers
Use build caching effectively
❌ DON'T
Use 'latest' tag in production
Run as root user
Include secrets in images
Create unnecessary layers
Install unnecessary packages
Ignore security updates
Store data in containers
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: aj-geddes-useful-ai-prompts-docker-containerization3description: Docker Containerization4---56# Docker Containerization78## Table of Contents910- [Overview](#overview)11- [When to Use](#when-to-use)12- [Quick Start](#quick-start)13- [Reference Guides](#reference-guides)14- [Best Practices](#best-practices)1516## Overview1718Build production-ready Docker containers following best practices for security, performance, and maintainability.1920## When to Use2122- Containerizing applications for deployment23- Creating Dockerfiles for new services24- Optimizing existing container images25- Setting up development environments26- Building CI/CD container pipelines27- Implementing microservices2829## Quick Start3031Minimal working example:3233```dockerfile34# Multi-stage build for Node.js application35# Stage 1: Build36FROM node:18-alpine AS builder37WORKDIR /app38COPY package*.json ./39RUN npm ci --only=production40COPY . .41RUN npm run build4243# Stage 2: Production44FROM node:18-alpine45WORKDIR /app46# Copy only production dependencies and built files47COPY --from=builder /app/node_modules ./node_modules48COPY --from=builder /app/dist ./dist49COPY package*.json ./5051# Security: Run as non-root user52RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 100153USER nodejs5455EXPOSE 300056CMD ["node", "dist/index.js"]57```5859## Reference Guides6061Detailed implementations in the `references/` directory:6263| Guide | Contents |64|---|---|65| [Multi-Stage Builds](references/multi-stage-builds.md) | Multi-Stage Builds |66| [Optimization Techniques](references/optimization-techniques.md) | Optimization Techniques |67| [Security Best Practices](references/security-best-practices.md) | Security Best Practices, Environment Configuration |68| [Docker Compose for Multi-Container](references/docker-compose-for-multi-container.md) | Docker Compose for Multi-Container |69| [.dockerignore File](references/dockerignore-file.md) | .dockerignore File |70| [Python](references/python.md) | Python (Django/Flask), Java (Spring Boot), Go |7172## Best Practices7374### ✅ DO7576- Use official base images77- Implement multi-stage builds78- Run as non-root user79- Use .dockerignore80- Pin specific versions81- Include health checks82- Scan for vulnerabilities83- Minimize layers84- Use build caching effectively8586### ❌ DON'T8788- Use 'latest' tag in production89- Run as root user90- Include secrets in images91- Create unnecessary layers92- Install unnecessary packages93- Ignore security updates94- Store data in containers9596---97> Converted and distributed by [TomeVault](https://tomevault.io/claim/aj-geddes) — claim your Tome and manage your conversions.98<!-- tomevault:4.0:skill_md:2026-04-11 -->
Run npx skillmds@latest add tomevault-io/aj-geddes-useful-ai-prompts-docker-containerization in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Docker Containerization It is listed under DevOps & Infra on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.