Skip to content
Back to skills

Dockerfile Scan

DSecurity

Scan a Dockerfile for insecure build patterns — running as root, unpinned or :latest base images, ADD from remote URLs, piping curl/wget into a shell, hardcoded secrets in ENV/ARG, world-writable chmod 777, and sudo usage. Use when the user asks to "review my Dockerfile", "is this container image secure", "lint my Dockerfile for security", or "why does my image run as root".

  • 12 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 6, 2026
securitypythonshellbashdockersecurity

Security analysis

D50/100
  • criticalPipes output to a shell interpreter
  • criticalDownloads and executes remote scripts — classic supply chain attack

Pro scans all 3 files and shows the line behind each finding

Scanned September 6, 2026

npx -y skills add NovaCode37/claude-security-skills --skill dockerfile-scan --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dockerfile Scan?

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

Security grade badge for Dockerfile Scan
[![Security: D — Skills Directory](https://www.skillsdirectory.com/api/skills/novacode37-dockerfile-scan/badge)](https://www.skillsdirectory.com/skills/novacode37-dockerfile-scan)

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: dockerfile-scan
description: >-
  Scan a Dockerfile for insecure build patterns — running as root, unpinned or
  :latest base images, ADD from remote URLs, piping curl/wget into a shell,
  hardcoded secrets in ENV/ARG, world-writable chmod 777, and sudo usage. Use
  when the user asks to "review my Dockerfile", "is this container image
  secure", "lint my Dockerfile for security", or "why does my image run as
  root".
license: MIT
---

# Dockerfile Security Scan

Parses a Dockerfile and flags common security and supply-chain problems, each
with a concrete fix. Pure text analysis — no Docker daemon, no network, stdlib
only.

## When to use this skill

- "Review this Dockerfile for security issues."
- "Is my container running as root?"
- "Lint my Dockerfiles before I push them."

## What it checks

- **Base image pinning** — missing tag or `:latest` (`docker-no-tag`,
  `docker-latest-tag`).
- **Runs as root** — no `USER`, or final `USER` is root (`docker-root-user`).
- **Remote code execution** — `curl|wget … | sh` (`docker-remote-exec`).
- **Remote ADD** — `ADD http://…` without integrity checks
  (`docker-add-remote`).
- **Hardcoded secrets** — `ENV`/`ARG` with a secret-looking name and a value
  (`docker-hardcoded-secret`).
- **Loose permissions** — `chmod 777` (`docker-chmod-777`).
- **sudo usage** in `RUN` (`docker-sudo`).

## How to run it

```bash
# Scan one Dockerfile
python skills/dockerfile-scan/scanner.py path/to/Dockerfile

# Scan every Dockerfile under a directory, as JSON
python skills/dockerfile-scan/scanner.py . --json
```

**Exit codes:** `0` clean · `1` findings present · `2` usage/IO error.

## Recommended workflow for Claude

1. Run the scan on the file or repo.
2. Present findings by severity, each with its one-line fix.
3. Offer a corrected Dockerfile snippet (pinned base image, non-root `USER`,
   `COPY` instead of remote `ADD`, secrets moved to runtime).

Files in this skill

  • SKILL.md1.9 KB
  • scanner.py8.3 KB
  • tests/test_scanner.py3.6 KB

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 security →

Comments

Loading comments…

Newsletter

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