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)
🔍 Real-time analysis: 51 rulesProblems appear in the Problems panel as you type (debounced, typically < 5 ms per file).
See the full rule list below. ⚡ Quick fixesMore than 25 rules have one-click fixes ( 📊 Scores, report and status bar
🎓 Learning mode
✨ AI-powered suggestions (optional)If a VS Code language model is available (e.g. GitHub Copilot):
Everything else works fully offline with no AI. 🏗 CI/CD integrationThe extension bundles the same engine as a command-line tool:
A ready-made GitHub Actions workflow ships in ⚙️ ConfigurationTeam config:
|
| 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