Container Security Scanner
Paste your Dockerfile to get an instant security audit. Each rule is checked with a pass/fail/warning result and an explanation. Also generates a hardened Dockerfile template based on your base image.
Dockerfile Input
Generate Hardened Template
Security Score
Security Checklist
Scan a Dockerfile to see results.
Frequently Asked Questions
Why should containers run as non-root users?▼
Running as root inside a container is dangerous because if an attacker escapes the container (via a kernel vulnerability or misconfiguration), they gain root on the host. The principle of least privilege requires containers run as an unprivileged user. Use USER directive in Dockerfile: 'RUN addgroup -S appgroup && adduser -S appuser -G appgroup' then 'USER appuser'. Kubernetes SecurityContext can also enforce non-root at the pod level with runAsNonRoot: true.
What are the most secure base images to use?▼
Minimal base images reduce attack surface by containing fewer packages that could have vulnerabilities. Best options: scratch (empty, for statically compiled Go/Rust binaries), distroless (Google's minimal images without shell or package manager), Alpine (musl libc + BusyBox, ~5MB), Chainguard images (hardened, continuously patched). Avoid full debian/ubuntu/centos for production — they include compilers, package managers, and hundreds of packages you don't need.
Why are multi-stage builds important for security?▼
Multi-stage builds separate the build environment (with compilers, dev dependencies, secrets needed for fetching packages) from the final runtime image. Build secrets, SSH keys, and dev tools never appear in the final image layers. The final image only contains compiled artifacts. This dramatically reduces image size and attack surface — a typical Go app goes from 800MB to 10MB, and a Node.js app from 400MB to 50MB with multi-stage builds.
What secrets should never appear in ENV or ARG instructions?▼
API keys, database passwords, private keys, tokens, and any credentials should never be in ENV (they're visible in docker inspect and image metadata) or ARG (visible in build history). Use Docker secrets (--secret flag) for build-time secrets, or runtime secrets injection via environment from your orchestration layer (Kubernetes Secrets, AWS Secrets Manager, Vault). Scan images with tools like Trivy, docker scan, or Hadolint to detect hardcoded secrets.
What is a HEALTHCHECK and why does it matter?▼
The HEALTHCHECK instruction tells Docker how to test if a container is still working correctly. Without it, Docker only tracks if the process is running — not if it's actually healthy (e.g., the app might be deadlocked or returning errors). A health check enables orchestrators (Kubernetes, Swarm) to restart unhealthy containers and route traffic away from them. Example: 'HEALTHCHECK --interval=30s --timeout=3s --retries=3 CMD wget -qO- http://localhost:8080/health || exit 1'
Related Products
on GumroadGitHub Actions CI/CD Templates Pack
12 production-ready GitHub Actions workflow templates covering Node.js, Python, Docker, multi-environment deployments, security scanning, and auto-changelog. Copy, paste, ship.
Buy on Gumroad →Developer Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →Developer Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →You Might Also Need
Docker Run Command Builder
Build complete docker run commands visually. Configure image, ports, volumes, environment variables, network, restart policy, detached mode, and more. Generates the exact docker run command.
Open free tool →
Dockerfile Linter
Paste your Dockerfile and instantly check for common issues: latest tags, missing HEALTHCHECK, running as root, cache-busting COPY order, ADD vs COPY, and multi-stage build suggestions.
Open free tool →
Dockerfile Generator
Interactive wizard to generate production-ready Dockerfiles for Node.js, Python, Go, Java, and Rust. Multi-stage builds, port config, custom layers.
Open free tool →
More Free Tools
Related Articles
Docker Compose vs Kubernetes: When to Use Each (2026)
A practical guide to choosing between Docker Compose and Kubernetes in 2026. Compare complexity, use cases, cost, and learn when to migrate from one to the other.
Docker vs Kubernetes: When to Use Each (2025 Guide)
Docker vs Kubernetes 2025: key differences, Docker Compose vs Kubernetes, cost comparison, and a clear decision framework with real-world use cases.
Docker vs Podman: Container Runtime Comparison 2026
Docker vs Podman container runtime comparison 2026: architecture, security, performance, migration guide, and when to choose each container tool.
Docker vs Podman: Container Runtime Comparison for 2026
Docker vs Podman 2026: daemonless architecture, rootless containers, Kubernetes compatibility, and Docker Desktop alternatives with full migration guide.
Docker vs Kubernetes: When to Use What (Decision Framework)
Docker vs Kubernetes: decision framework for choosing container technology by team size and scale. Includes migration paths and real-world use cases.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →