Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Dockttier: Dockerfile Templates, Security & OptimizationNew to Visual Studio Code? Get it now.
Dockttier: Dockerfile Templates, Security & Optimization

Dockttier: Dockerfile Templates, Security & Optimization

dockttier

|
1 install
| (0) | Free
Production-ready Dockerfile templates plus real-time security, optimization and best-practice analysis with one-click fixes, scores, a CI command line and AI review.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Dockttier 🐳🛡

Dockerfile templates, real-time security and optimization analysis, one-click fixes, scores, a CI command-line tool and AI review, all in VS Code.

Dockttier helps teams ship containers that are secure by default, small and fast to build. Start from a verified template, get problems underlined as you type, fix them with one click, and run the same checks in CI.


✨ Features

📦 Template library (16 templates, all grade A)

Templates
Basic · Single-stage Node.js, Python, Static site (unprivileged NGINX)
Basic · Multi-stage Frontend SPA → NGINX, Go → Alpine
Production · Multi-stage Node.js (deps/build/runtime + tini), Python (venv + gunicorn), Java Spring Boot (layered jar), .NET (Alpine ASP.NET), Rust (distroless cc)
Production · Security Node.js on distroless, Python on distroless with hash-verified deps, Go on scratch
Production · Optimization Node.js with pnpm + BuildKit cache, Python with uv, Java with a custom jlink JRE
  • Quick Pick (Dockttier: Insert Dockerfile Template…) grouped Basic / Production, with security and optimization scores.
  • Template Gallery webview: search, filter by goal or language, inspect, fill in variables ({{NODE_VERSION}}, {{PORT}} …) and create.
  • Generate Dockerfile for Project detects your stack (package.json, pnpm-lock.yaml, uv.lock, go.mod, pom.xml, *.csproj, Cargo.toml …) and recommends the best template.
  • Template tree view in the Dockttier activity bar.
  • Team templates: save any Dockerfile as a template into .dockttier/templates/ and commit it. Add personal folders with dockttier.templates.paths, or a shared cloud repository with dockttier.templates.remoteUrl (HTTPS JSON, cached offline).
  • Template scores are computed by the analyzer, not hand-written, so they can't drift.

🔍 Real-time analysis: 51 rules

Problems appear in the Problems panel as you type (debounced, typically < 5 ms per file).

  • 🛡 Security (17): root user, latest / untagged images, secrets in ENV/ARG, hardcoded credentials (AWS, GitHub, Slack, Stripe, private keys …), curl | sh, ADD <url> without checksum, sudo, chmod 777, SSH port, disabled TLS verification, unsigned packages, copied .env / keys, end-of-life images, digest pinning, trusted registries and banned images policies.
  • 🚀 Optimization (13): consecutive RUNs, COPY . . before dependency install, apt/apk/pip/yum cache cleanup, --no-install-recommends, slim/alpine bases, multi-stage for compiled languages, npm ci, missing .dockerignore, large build context, BuildKit cache mounts.
  • ✅ Best practice (21): exec-form CMD/ENTRYPOINT, pipefail, absolute WORKDIR, HEALTHCHECK, OCI labels, duplicate CMD, invalid JSON form, invalid EXPOSE, bad COPY --from references, duplicate stage names, MAINTAINER, legacy ENV k v, apt vs apt-get, typos in instructions ("Did you mean RUN?") …

See the full rule list below.

⚡ Quick fixes

More than 25 rules have one-click fixes (Ctrl+.), for example: pin a base image, add a non-root user (aware of Alpine, Debian and distroless), reorder COPY for caching, merge RUNs, add cache cleanup, convert to exec form, npm install → npm ci --omit=dev, add pipefail (uses SHELL bash on Debian, where dash has no pipefail). Every finding also offers ignore for this line, disable rule and learn more. Fix All (Dockttier: Fix All, CodeLens, or source.fixAll.dockttier on save) applies safe fixes repeatedly until nothing changes.

📊 Scores, report and status bar

  • Status bar: Dockttier B 84 with a hover breakdown.
  • CodeLens: scores, fix count and per-stage issue counts above the file.
  • Analysis report webview: overall, security, optimization and best-practice score rings; an image profile (non-root, multi-stage, minimal base, digests, health check, exec form, cache and secret mounts, layer count); findings grouped by category with "reveal" and "fix" buttons; export to Markdown, SARIF or JSON.

🎓 Learning mode

  • Hover a keyword for instruction docs, hover FROM images for size, recommended tags and EOL warnings.
  • Hover a problem for the explanation and a before/after example.
  • Rules & Learning view and a Learn panel documenting every rule.
  • A Getting Started walkthrough.
  • Completions for instructions (snippets), base images with recommended tags, distroless images, stage names and BuildKit --mount options.

✨ AI-powered suggestions (optional)

If a VS Code language model is available (e.g. GitHub Copilot):

  • Dockttier: AI Review streams a context-aware review plus an improved Dockerfile, using the static findings as grounding.
  • @dockttier chat participant: /review, /template <what you're building>, /explain DT1002.

Everything else works fully offline with no AI.

🏗 CI/CD integration

The extension bundles the same engine as a command-line tool:

node out/cli.js .                          # scan all Dockerfiles, fail on errors
node out/cli.js . --fail-on warning        # stricter
node out/cli.js . -f sarif -o dockttier.sarif   # GitHub code scanning
node out/cli.js . -f markdown >> $GITHUB_STEP_SUMMARY
node out/cli.js Dockerfile --fix           # apply safe fixes
node out/cli.js . --min-score 80           # quality gate

A ready-made GitHub Actions workflow ships in examples/github-actions.yml inside the extension source.


⚙️ Configuration

Team config: .dockttierrc.json

Shared by the editor and the CLI (JSON with comments, schema-validated in VS Code):

{
  "rules": { "DT3009": "off", "no-sudo": "error" },   // id or name → off | error | warning | info | hint
  "trustedRegistries": ["docker.io/library", "ghcr.io/acme"],
  "bannedImages": ["ubuntu:1*", "*/deprecated-base*"],
  "requiredLabels": ["org.opencontainers.image.source"],
  "requireDigests": false
}

Inline suppression

# dockttier-ignore DT1002 DT3006
FROM gcr.io/my/base:1.0
# dockttier-ignore-file DT3009

Settings

Setting Default Description
dockttier.enable true Enable analysis
dockttier.analyzeOnType / debounceMs true / 250 Live analysis
dockttier.rules {} Severity overrides
dockttier.trustedRegistries, bannedImages, requiredLabels, requireDigests Policy (same as rc file)
dockttier.checkBuildContext / buildContextWarningMB true / 100 Build context size warning
dockttier.hover.enable, learningMode, codeLens.enable, statusBar.enable true UI
dockttier.templates.paths, templates.remoteUrl Extra template sources
dockttier.ai.enable, ai.modelFamily true, "" AI features

📋 Rules

ID Category Default Name Rule
DT1001 security warning pin-base-image-tag Pin base image versions instead of using latest
DT1002 security warning run-as-non-root Final image should not run as root
DT1003 security warning no-root-user Do not switch the final stage back to root
DT1004 security error no-secrets-in-env-arg Do not pass secrets through ENV or ARG
DT1005 security warning no-curl-pipe-shell Do not pipe remote scripts into a shell
DT1006 security warning no-add-remote-url Avoid ADD with remote URLs without a checksum
DT1007 security warning no-sudo Do not use sudo in Dockerfiles
DT1008 security warning no-world-writable Avoid world-writable permissions
DT1009 security warning no-ssh-port Do not expose SSH (port 22)
DT1010 security error no-insecure-tls Do not disable TLS certificate verification
DT1011 security error no-sensitive-files Do not copy credentials or keys into the image
DT1012 security hint pin-base-image-digest Pin base images by digest for reproducible builds
DT1013 security error no-unverified-packages Do not install unsigned or unverified packages
DT1014 security warning no-eol-base-image Do not use deprecated or end-of-life base images
DT1015 security error trusted-registry Base images must come from trusted registries
DT1016 security error banned-image Do not use banned base images
DT1017 security error no-hardcoded-credentials Do not hardcode credentials
DT2001 optimization info combine-consecutive-run Combine consecutive RUN instructions
DT2002 optimization warning copy-before-install Copy dependency manifests before the full source
DT2003 optimization warning apt-cleanup Clean the apt cache in the same layer
DT2004 optimization info apt-no-install-recommends Use --no-install-recommends with apt-get
DT2005 optimization info apk-no-cache Use apk add --no-cache
DT2006 optimization info pip-no-cache-dir Use pip install --no-cache-dir
DT2007 optimization info prefer-slim-base Prefer a smaller base image for the runtime stage
DT2008 optimization warning use-multi-stage Use a multi-stage build for compiled applications
DT2009 optimization info yum-dnf-cleanup Clean yum/dnf/zypper caches in the same layer
DT2010 optimization info prefer-npm-ci Use npm ci for reproducible installs
DT2011 optimization warning missing-dockerignore Add a .dockerignore file
DT2012 optimization warning large-build-context Keep the build context small
DT2013 optimization hint use-cache-mounts Use BuildKit cache mounts for package managers
DT3001 best-practice warning no-maintainer MAINTAINER is deprecated
DT3002 best-practice warning absolute-workdir Use absolute paths for WORKDIR
DT3003 best-practice info use-workdir Use WORKDIR instead of cd
DT3004 best-practice warning single-cmd-entrypoint Only one CMD, ENTRYPOINT and HEALTHCHECK per stage
DT3005 best-practice warning exec-form Use exec (JSON) form for CMD and ENTRYPOINT
DT3006 best-practice info healthcheck Define a HEALTHCHECK for long-running services
DT3007 best-practice warning apt-get-yes Use -y with apt-get install
DT3008 best-practice warning prefer-apt-get Use apt-get instead of apt in scripts
DT3009 best-practice info oci-labels Add OCI image labels
DT3010 best-practice info uppercase-instruction Write instructions in uppercase
DT3011 best-practice error unknown-instruction Unknown instruction
DT3012 best-practice error from-first Dockerfile must start with FROM
DT3013 best-practice error valid-stage-reference COPY --from must reference an earlier stage
DT3014 best-practice error unique-stage-names Stage names must be unique and not reserved
DT3015 best-practice warning pipefail Set pipefail when using pipes
DT3016 best-practice error valid-expose EXPOSE must use valid ports
DT3017 best-practice error copy-dest-directory COPY with multiple sources needs a directory destination
DT3018 best-practice info env-key-value Use ENV key=value syntax
DT3019 best-practice error valid-json-form Exec form must be valid JSON
DT3020 best-practice warning prefer-copy Use COPY instead of ADD for local files
DT3021 best-practice warning apt-update-alone Do not run apt-get update in a separate layer

🧱 Architecture

src/
  core/            Pure TypeScript, no VS Code dependency (shared by extension and CLI)
    parser.ts      Position-preserving Dockerfile parser (directives, continuations, heredocs, stages, flags, JSON form)
    shell.ts       Quote-aware shell command splitter for RUN analysis
    rules/         51 rules: security.ts, optimization.ts, bestPractice.ts
    analyzer.ts    Rule engine, config/ignores, scoring, fix application
    templates.ts   Template model, validation, rendering, recommendation
    insights.ts    Image profile (non-root, multi-stage, minimal base …)
  vscode/          Diagnostics, code actions, hover, completion, CodeLens, status bar,
                   tree views, gallery/report/learn webviews, AI and chat
  cli.ts           CI command line (text, JSON, SARIF, Markdown; --fix; quality gates)
templates/         JSON template library
schemas/           JSON schemas for .dockttierrc.json and team templates

🧪 Development

npm install
npm run typecheck
npm test          # 180 unit tests: parser, every rule (positive + negative), fixes, templates, CLI, performance
npm run build     # bundles out/extension.js and out/cli.js with esbuild
npm run package   # produces dockttier-<version>.vsix

Press F5 in VS Code to launch an Extension Development Host.

📄 License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft