dot-claude/skills/docker-security/SKILL.md
Container hardening, image security, and Docker best practices. Use when building, scanning, or securing containers and images.
npx skillsauth add sutanunandigrami/claude-titan-setup docker-securityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
hadolint Dockerfiletrivy image <org>/<app>:<tag> — catch CVEs before registry pushsyft <org>/<app>:<tag> -o spdx-json > sbom.spdx.jsondive <org>/<app>:<tag> — identify bloat, leaked filesgcr.io/distroless/base:nonroot or cgr.io/chainguard/base:latestRUN useradd -m -u 1000 app && chown -R app:app /app → USER appdocker run --read-only --tmpfs /tmp --tmpfs /run <image>docker run --cap-drop=ALL --cap-add=NET_BIND_SERVICE <image>RUN --mount=type=secret (Docker 18.04+)services:
app:
image: <image>:<pinned-tag> # Never use latest in prod
user: "1000:1000"
read_only: true
cap_drop: [ALL]
cap_add: [NET_BIND_SERVICE]
tmpfs: [/tmp, /run]
security_opt:
- no-new-privileges:true
networks:
- internal
networks:
internal:
driver: bridge
driver_opts:
com.docker.network.bridge.enable_icc: "false" # Block inter-container comms
trivy image --scan-secrets <org>/<app>:<tag> # Leaked secrets in layers
grype <org>/<app>:<tag> # CVE + secret detection
gitleaks detect . # Pre-push secret scan
cosign sign <image>:<tag> # Sign (requires COSIGN_KEY env)
cosign verify --key cosign.pub <image>:<tag> # Verify on pull
trivy image --severity HIGH,CRITICAL --exit-code 1 <image>:<tag> # Gate in CI
crane manifest <image>:<tag> | jq . # Inspect remote manifest
cosign tree <image>:<tag> # Check provenance + attestations
docker run --security-opt apparmor=docker-default <image> # AppArmor profile
docker run -m 512m --cpus=1 <image> # Limit resources (DoS protection)
docker run -v /data:/data:ro <image> # Read-only volume mounts
docker run --security-opt no-new-privileges:true <image> # Block privilege escalation
# Verify storage driver: docker info | grep "Storage Driver" (should be overlay2)
# Stage 1: Build
FROM golang:1.21 AS builder
WORKDIR /app
COPY . .
RUN go build -o myapp .
# Stage 2: Runtime (distroless — no shell, no package manager)
FROM gcr.io/distroless/base:nonroot
COPY --from=builder /app/myapp /myapp
USER nonroot
ENTRYPOINT ["/myapp"]
latest tag in deployments — use commit SHA or semver.dockerignoreapt-get install && apt-get clean in single RUN layertrivy --exit-code 1 on CRITICAL)--privileged unless absolutely necessarytools
Project workspace configuration — auto-detect commands, _workspace.json convention, .envrc templates
development
This skill helps Claude write secure web applications. Use this when working on any web application or when a user requests a scan or audit to ensure security best practices are followed.
tools
Configures Python projects with modern tooling (uv, ruff, ty). Use when creating projects, writing standalone scripts, or migrating from pip/Poetry/mypy/black.
tools
Control tmux sessions — create panes, run commands, read output, monitor processes