Back to skills
SKILL.md
Docker Best Practices
ASecuritySmall, secure, reproducible Docker images: multi-stage builds, pinned bases, non-root users, caching and healthchecks.
- 2 stars
- 0 votes
- 0 copies
- 0 views
- Added December 2, 2026
Security analysis
100/100npx -y skills add karthikrshet/saarthi --skill docker-best-practices --agent claude-codeAre you the author of Docker Best Practices?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/karthikrshet-docker-best-practices)---
name: docker-best-practices
description: "Small, secure, reproducible Docker images: multi-stage builds, pinned bases, non-root users, caching and healthchecks."
tags: [devops]
---
# Docker Best Practices
## When to use
- Writing or reviewing Dockerfiles
## Procedure
1. Use multi-stage builds
2. Pin base image digests or versions
3. Copy lockfiles first for caching
4. Run as non-root
5. Add HEALTHCHECK
6. Use .dockerignore
## Example
```dockerfile
FROM node:22-slim AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build && npm prune --omit=dev
FROM node:22-slim
WORKDIR /app
USER node
COPY --from=build --chown=node /app/dist ./dist
COPY --from=build --chown=node /app/node_modules ./node_modules
CMD ["node", "dist/main.js"]
```
## Checklist
- [ ] Image scanned (trivy/grype)
- [ ] No secrets in layers
## Anti-patterns
- latest tags
- Installing build tools in runtime image
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.