Docker Containerization

Docker Containerization

Guides an AI agent to write optimised Dockerfiles and Compose setups using multi-stage builds, non-root users, small images and security best practices.

Skill files9 files

references/

scripts/

templates/

SKILL.md99 lines
1
---
2
name: docker-containerization
3
description: >
4
Create optimized Docker containers with multi-stage builds, security best
5
practices, and minimal image sizes. Use when containerizing applications,
6
creating Dockerfiles, optimizing container images, or setting up Docker
7
Compose services.
8
---
9
10
# Docker Containerization
11
12
## Table of Contents
13
14
- [Overview](#overview)
15
- [When to Use](#when-to-use)
16
- [Quick Start](#quick-start)
17
- [Reference Guides](#reference-guides)
18
- [Best Practices](#best-practices)
19
20
## Overview
21
22
Build production-ready Docker containers following best practices for security, performance, and maintainability.
23
24
## When to Use
25
26
- Containerizing applications for deployment
27
- Creating Dockerfiles for new services
28
- Optimizing existing container images
29
- Setting up development environments
30
- Building CI/CD container pipelines
31
- Implementing microservices
32
33
## Quick Start
34
35
Minimal working example:
36
37
```dockerfile
38
# Multi-stage build for Node.js application
39
# Stage 1: Build
40
FROM node:18-alpine AS builder
41
WORKDIR /app
42
COPY package*.json ./
43
RUN npm ci --only=production
44
COPY . .
45
RUN npm run build
46
47
# Stage 2: Production
48
FROM node:18-alpine
49
WORKDIR /app
50
# Copy only production dependencies and built files
51
COPY --from=builder /app/node_modules ./node_modules
52
COPY --from=builder /app/dist ./dist
53
COPY package*.json ./
54
55
# Security: Run as non-root user
56
RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
57
USER nodejs
58
59
EXPOSE 3000
60
CMD ["node", "dist/index.js"]
61
```
62
63
## Reference Guides
64
65
Detailed implementations in the `references/` directory:
66
67
| Guide | Contents |
68
|---|---|
69
| [Multi-Stage Builds](references/multi-stage-builds.md) | Multi-Stage Builds |
70
| [Optimization Techniques](references/optimization-techniques.md) | Optimization Techniques |
71
| [Security Best Practices](references/security-best-practices.md) | Security Best Practices, Environment Configuration |
72
| [Docker Compose for Multi-Container](references/docker-compose-for-multi-container.md) | Docker Compose for Multi-Container |
73
| [.dockerignore File](references/dockerignore-file.md) | .dockerignore File |
74
| [Python](references/python.md) | Python (Django/Flask), Java (Spring Boot), Go |
75
76
## Best Practices
77
78
### ✅ DO
79
80
- Use official base images
81
- Implement multi-stage builds
82
- Run as non-root user
83
- Use .dockerignore
84
- Pin specific versions
85
- Include health checks
86
- Scan for vulnerabilities
87
- Minimize layers
88
- Use build caching effectively
89
90
### ❌ DON'T
91
92
- Use 'latest' tag in production
93
- Run as root user
94
- Include secrets in images
95
- Create unnecessary layers
96
- Install unnecessary packages
97
- Ignore security updates
98
- Store data in containers
99

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 13,690 prompts

More by @OpenSourceBuffGuy

See all
Four city outfit change with depth reference prompt image

Four city outfit change with depth reference

Directs a 12-second vertical video where one woman spins through four city outfit changes, locked to outfit pictures, a face crop and a depth-video motion reference.

video-prompt, reference-image, character-consistency, face-reference, timed-beats, multi-shot, vertical-format, transformation, video-ad, travel, scene-transitions, camera-movement, fashion, cityscape, landmarks, short-form-video, long-form, structured-output, woman, fashion-shoot

Quiet Kyoto autumn travel vlog, 30 seconds prompt image

Quiet Kyoto autumn travel vlog, 30 seconds

Generates a slow, natural 30-second autumn travel vlog in Kyoto of the woman from a reference image, with short casual dialogue, handheld camera and film grain, avoiding an ad look.

video-prompt, vlog, reference-image, character-consistency, handheld, film-grain, home-video, travel, japan, multi-shot, lip-sync, natural-light, guardrails, seedance, for-content-creators, timed-beats, long-form, casual, candid, autumn

Ice heroine fights hunters in Seoul parking garage prompt image

Ice heroine fights hunters in Seoul parking garage

Plans a 30-second supernatural action film where an ice-powered heroine defends a puppy from hunters in a Seoul parking garage, with identity locked to two reference images.

video-prompt, kling, timed-beats, multi-shot, action, martial-arts, visual-effects, character-consistency, reference-image, korea, cityscape, night-scene, slow-motion, tracking-shot, cinematic, creatures, film-score, negative-prompt, dramatic-lighting, neon, advanced, lip-sync, woman

Reviews

Loading reviews…

Discussion

Loading comments…