Skip to content
Back to skills

Docker Best Practices

ASecurity

Small, 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
ai-agentsnodedockerdevops

Security analysis

A100/100

Scanned December 2, 2026

npx -y skills add karthikrshet/saarthi --skill docker-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Docker Best Practices?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Docker Best Practices
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/karthikrshet-docker-best-practices/badge)](https://www.skillsdirectory.com/skills/karthikrshet-docker-best-practices)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.