anton-abyzov/vskill-test-public-skills-826/dockerfile-hardening-guide

Claude Code and agent skill by anton-abyzov/vskill-test-public-skills-826

Trust tier 4
  • vendor
Source check pending

Checking that the SKILL.md file is still in the repository.

Harden Dockerfiles for security and size — non-root users, pinned bases, multi-stage builds, minimal layers, and supply-chain hygiene.

Install

npx vskill@latest install anton-abyzov/vskill-test-public-skills-826/dockerfile-hardening-guide

SKILL.md

The same SKILL.md was published earlier as anton-abyzov/vskill-test-public-skills-826/dockerfile-hardening-guide.

dockerfile-hardening-guide

Turn a working-but-risky Dockerfile into a small, reproducible, least-privilege image. Use this when reviewing or authoring container builds.

Checklist

Base image
  • Pin by digest, not a moving tag: FROM node:20.14.0-bookworm-slim@sha256:....

Tags like latest make builds non-reproducible.

  • Prefer -slim or distroless over full distros. Fewer packages means fewer

CVEs and a smaller image.

  • Use multi-stage builds so compilers and dev dependencies never reach the

runtime image.

Run as non-root

Containers default to UID 0. Create and switch to an unprivileged user:

dockerfile
RUN groupadd --gid 10001 app \
&& useradd --uid 10001 --gid app --no-create-home app
USER 10001:10001

Use a numeric UID in USER so Kubernetes runAsNonRoot checks pass even if the username is not resolvable.

Minimize layers and content
  • Combine related RUN steps and clean caches in the same layer:
dockerfile
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
  • Add a .dockerignore (.git, node_modules, *.env, tests/) so secrets

and bulk never enter the build context.

  • Copy only what you need. COPY . . drags in everything.
Secrets and build args
  • Never ARG/ENV a secret — it persists in image history and docker history

reveals it. Use BuildKit secret mounts instead:

dockerfile
RUN --mount=type=secret,id=npmrc npm ci
  • Do not bake tokens into layers. Inject runtime config via the orchestrator.
Multi-stage example
dockerfile
# syntax=docker/dockerfile:1.7
FROM golang:1.22-bookworm@sha256:... AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o /out/app ./cmd/app
FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=build /out/app /app
USER nonroot:nonroot
ENTRYPOINT ["/app"]

Runtime hardening

  • Add a HEALTHCHECK so orchestrators detect a wedged process.
  • Set WORKDIR explicitly; never run from /.
  • Drop Linux capabilities and set a read-only root filesystem at the orchestrator

level (securityContext.readOnlyRootFilesystem: true).

Scoring table

ControlRisk if missingPriority
Non-root USERcontainer escape blast radiushigh
Pinned base digestnon-reproducible / poisoned basehigh
No secrets in layerscredential leakhigh
.dockerignoresecret/source leak, bloatmedium
Multi-stage buildbloated attack surfacemedium
HEALTHCHECKsilent failureslow

Agent guidance

  • When reviewing, output a prioritized list (high → low), not a flat dump.
  • Verify the base image still builds after switching to -slim/distroless.
  • Confirm the app actually runs as the chosen UID before approving.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files. Certified 10 Jun 2026.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill CERTIFIED badge
[![vskill CERTIFIED](https://verified-skill.com/api/v1/skills/anton-abyzov/vskill-test-public-skills-826/dockerfile-hardening-guide/badge)](https://verified-skill.com/skills/anton-abyzov/vskill-test-public-skills-826/dockerfile-hardening-guide)

Something wrong with this skill or its page? Tell us.