Use when working with ANY Docker task: writing Dockerfiles, configuring docker-compose/compose.yml, multi-stage builds, docker-bake.hcl, container security audits, .dockerignore optimization, or CI/CD container testing.
Use when working with ANY Docker task: writing Dockerfiles, configuring docker-compose/compose.yml, multi-stage builds, docker-bake.hcl, container security audits, .dockerignore optimization, or CI/CD container testing.
Files included with this skill beyond the listing page.
skill mdSKILL.md4,664 B
docsSUMMARY.md345 B
History
First seen on skills.sh
First recorded snapshot · 323 installs
SKILL.md
Docker Development
Core Principles
Minimal -- Alpine/distroless, multi-stage
Secure -- Non-root USER, no layer secrets, pin versions
Testable -- entrypoint bypass, DNS mocking
Cache-efficient -- deps first, clean in-layer
Quick Reference
Multi-Stage Build (Node.js)
FROM node:24-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
FROM node:24-alpine
RUN addgroup -g 1001 app && adduser -u 1001 -G app -D app
USER app
COPY --from=builder /app .
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget -qO- http://localhost:3000/health || exit 1
CMD ["node", "server.js"]
Multi-Stage Build (Go -- scratch/distroless)
FROM golang:1.26-alpine AS builder
WORKDIR /app
COPY go.* ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /app/server .
FROM gcr.io/distroless/static:nonroot
COPY --from=builder /app/server /server
CMD ["/server"]
profiles: [debug]: start only with --profile debug
shared image ref: define ONCE per file as top-level extension field + anchor -- x-app-image: &app-image registry/app:${APPIMAGEVERSION:-85}, services use image: *app-image. The field must sit ABOVE services: — an alias is only valid after its anchor in document order. :- defaults cover unset AND empty vars (a bare omitted tag silently resolves :latest). Anchors are file-local: every overlay file needs its own. Verify both paths: APPIMAGEVERSION= docker compose config and with an override
References
references/ci-testing.md -- CI testing patterns for Docker images