docker — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited docker (Agent Skill) and scored it 96/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 1 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 1 flagged
The text {match} tells the agent to skip the normal "ask the user first" gate. Used adversarially it removes the human-in-the-loop check before destructive or sensitive actions, turning a normally-gated agent into a fire-and-forget executor.
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Production-grade Docker containerization with security-first defaults.
Before generating Dockerfiles/Compose, detect the environment:
# Detect host machine memory
sysctl -n hw.memsize 2>/dev/null | awk '{print $0/1024/1024/1024 " GB"}' || \
grep MemTotal /proc/meminfo | awk '{print $2/1024/1024 " GB"}'
# Detect Docker allocated resources
docker info --format 'Memory: {{.MemTotal}}, CPUs: {{.NCPU}}'
# Detect available disk space
docker system dfAdapt configurations based on detection:
| Detected Docker Memory | Profile | Build Memory | Container Limits |
|---|---|---|---|
| < 4GB | Constrained | 1GB | 256Mi |
| 4-8GB | Minimal | 2GB | 512Mi |
| 8-12GB | Standard | 4GB | 1Gi |
| > 12GB | Extended | 8GB | 2Gi |
docker_memory * 0.6 / container_countConstrained (< 4GB Docker):
services:
app:
deploy:
resources:
limits:
memory: 256M
cpus: '0.25'
build:
args:
- BUILDKIT_STEP_LOG_MAX_SIZE=10000000⚠️ Agent should warn: "Docker memory low. Multi-stage builds may fail."
Standard (4-8GB Docker):
services:
app:
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
reservations:
memory: 256MExtended (> 8GB Docker):
services:
app:
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
reservations:
memory: 512MBefore running docker build, agent should verify:
# Check available memory
docker info --format '{{.MemTotal}}' | awk '{if ($1 < 4000000000) print "WARNING: Low memory"}'If constrained: use --memory flag and warn user about potential build failures.
Analysis & Detection:
Generation:
output: 'standalone' to Next.js, etc.)Validation:
Security:
:latest)Gather context to ensure successful implementation:
| Source | Gather |
|---|---|
| Codebase | Package files, existing Dockerfile, .env patterns |
| Conversation | Dev vs production target, base image preferences |
| Skill References | Framework patterns, multi-stage builds, security |
| User Guidelines | Registry conventions, naming standards |
Ask when not auto-detectable:
| Question | When to Ask |
|---|---|
| Target environment | "Building for development or production?" |
| Base image preference | "Standard slim images or enterprise hardened?" |
| Existing Docker files | "Enhance existing Dockerfile or create new?" |
| Registry target | "Local only or pushing to registry?" |
| File Present | Runtime | Package Manager |
|---|---|---|
requirements.txt, pyproject.toml, uv.lock | Python | pip/uv |
pnpm-lock.yaml | Node.js | pnpm |
yarn.lock | Node.js | yarn |
package-lock.json | Node.js | npm |
| What | Detect From |
|---|---|
| Python version | pyproject.toml (requires-python), .python-version, runtime.txt |
| Framework | Imports in code (from fastapi, from flask, import django) |
| Package manager | uv.lock → uv, poetry.lock → poetry, else pip |
| Native deps | Scan requirements: psycopg2, cryptography, numpy, pillow |
| App entrypoint | Find app = FastAPI(), app = Flask(), or manage.py |
| What | Detect From |
|---|---|
| Node version | .nvmrc, .node-version, package.json (engines.node) |
| Framework | package.json dependencies (next, express, @nestjs/core) |
| Package manager | pnpm-lock.yaml → pnpm, yarn.lock → yarn, else npm |
| Output type | Next.js: check next.config.js for output: 'standalone' |
| Issue | Action |
|---|---|
Next.js missing output: 'standalone' | Add it to next.config.js |
| No health endpoint found | Create /health/live and /health/ready |
| Using uv but no uv.lock | Run uv lock first |
| pyproject.toml but no build system | Use uv pip install -r pyproject.toml |
1. SCAN PROJECT
- Detect runtime, framework, version, entrypoint
- Find dependency files, native deps
- Locate existing Docker files (don't blindly overwrite)
↓
2. ANALYZE ENVIRONMENT
- Scan all .env* files
- Classify: SECRET (never bake) / BUILD_ARG / RUNTIME
- Flag security issues
↓
3. FIX CONFIGURATION
- Add Next.js `output: 'standalone'` if missing
- Create health endpoints if missing
- Generate .env.example with safe placeholders
↓
4. GENERATE FILES
- Dockerfile (customized CMD, paths, build deps)
- .dockerignore (excludes .env, secrets)
- compose.yaml (with security defaults)
↓
5. VALIDATE & TEST
- docker build --target dev -t app:dev .
- docker build --target production -t app:prod .
- Test health endpoints
- Verify non-root user
- Report image size
↓
6. DELIVER WITH CONTEXT
- All files with explanations
- Security scan command
- Any warnings about secrets
- Rollback instructions if replacing existingOnly ask if genuinely ambiguous (e.g., multiple apps in monorepo, conflicting configs)
| Choice | When to Use | Tradeoffs |
|---|---|---|
Slim {runtime}:X-slim | General production (default) | Works everywhere, no auth |
DHI dhi.io/{runtime}:X | SOC2/HIPAA, enterprise | Requires docker login dhi.io |
Alpine {runtime}:X-alpine | Smallest size | musl issues with native deps |
Default: Slim (works everywhere without authentication)
deps/base → Install dependencies (cached layer)
↓
builder → Build/compile application
↓
dev → Hot-reload, volume mounts (--target dev)
↓
production → Minimal DHI runtime (--target production)docker build --target dev -t myapp:dev .
docker build --target production -t myapp:prod .| Framework | Development | Production |
|---|---|---|
| FastAPI | uvicorn app.main:app --reload | uvicorn app.main:app --workers 4 |
| Flask | flask run --debug | gunicorn -w 4 app:app |
| Django | python manage.py runserver | gunicorn -w 4 project.wsgi |
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=cache,target=/root/.cache/pip \
uv pip install -r requirements.txt@asynccontextmanager
async def lifespan(app: FastAPI):
yield # startup
# shutdown logic here| Framework | Build | Output |
|---|---|---|
| Next.js | next build | .next/standalone |
| Express | tsc | dist/ |
| NestJS | nest build | dist/ |
# pnpm
RUN --mount=type=cache,target=/root/.local/share/pnpm/store \
pnpm install --frozen-lockfile
# npm
RUN --mount=type=cache,target=/root/.npm npm ci
# yarn
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn \
yarn install --frozen-lockfileprocess.on('SIGTERM', () => {
server.close(() => process.exit(0));
});Before delivering, verify:
.env, .git, secrets| File | Purpose |
|---|---|
Dockerfile | Multi-stage, multi-target build |
.dockerignore | Exclude sensitive/unnecessary files |
compose.yaml | Local development stack |
health.py / health endpoint | Framework-specific health checks |
| File | Purpose |
|---|---|
references/env-analysis.md | CRITICAL: Secret detection, .env classification |
references/production-checklist.md | CRITICAL: Validation before delivery |
| File | When to Read |
|---|---|
references/python/fastapi.md | FastAPI: uvicorn, lifespan |
references/python/flask.md | Flask: gunicorn, blueprints |
references/python/django.md | Django: gunicorn, middleware |
references/python/native-deps.md | Detect psycopg2, cryptography, etc. |
references/node/nextjs.md | Next.js: standalone, ISR |
references/node/package-managers.md | npm/yarn/pnpm caching |
| File | When to Read |
|---|---|
references/docker-hardened-images.md | If user needs enterprise security (DHI) |
references/multi-stage-builds.md | Complex build patterns |
Templates in templates/ are reference patterns, not copy-paste files.
Agent must:
src.app.main:app)Example customization:
# Template says:
CMD ["uvicorn", "app.main:app", ...]
# Agent detects app at src/api/main.py, generates:
CMD ["uvicorn", "src.api.main:app", ...]~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.