Docker Compose Linter · 18 Production Checks · 0 Bytes Uploaded

Free Docker Compose Security Linter (docker-compose.yml) — 18 Production Checks

Catch exposed Postgres/Redis/n8n ports on 0.0.0.0, privileged: true, /var/run/docker.sock mounts, plaintext environment secrets, and missing resilience guardrails before running docker compose up. Executes 100% locally in your browser with 0 bytes uploaded.

Run Free Local Scan Download Free .vsix (156 KB) Pro Solo — $29 one-time Pro Team (10 seats) — $49
18 rules
DKR001–DKR018 production checks
5 Quick Fixes
1-click IDE remediation (Cmd+.)
0 bytes
Uploaded — 100% browser YAML AST
CI + IDE
VS Code / Cursor / Windsurf + SARIF

Interactive docker-compose.yml Security Checker (18 Rules)

100% in-browser · 0 bytes sent · < 10 ms

Paste any docker-compose.yml or compose.yaml below—or load the vulnerable production sample in 1 click—to get line-accurate YAML AST findings, CWE/SOC 2/ISO/DORA mappings, and IDE Quick Fixes.

Enforce all 72 rules in VS Code, Cursor, Windsurf & CI Download the free .vsix locally—or unlock Pro once (no subscription) for full workspace audits, stackguard-cli, SARIF 2.1.0, and SHA-256 sealed SOC 2 / ISO 27001 / DORA reports.

All 18 Real Docker Compose Security Rules (DKR001–DKR018)

Every production check below runs on the exact YAML AST engine powering this zero-upload browser linter, the .vsix IDE extension, and stackguard-cli.

Rule ID Severity Risk & Compliance Mapping Quick Fix & Remediation
DKR001
Free
HIGH
Database, cache, or admin port exposed on 0.0.0.0
Sensitive service port (Postgres, MySQL, MongoDB, Redis, Elasticsearch, n8n, RabbitMQ, Docker API) is published on all network interfaces instead of 127.0.0.1.
CWE-668SOC 2 CC6.6ISO A.8.20DORA Art. 9(3)
1-Click IDE Quick Fix
Bind the port to localhost (127.0.0.1:HOST:CONTAINER) or remove public port publishing behind a TLS reverse proxy.
DKR002
Free
CRITICAL
Privileged container enabled (privileged: true)
Running a container with privileged: true grants near-complete root access to the host kernel and devices.
CWE-250SOC 2 CC6.3ISO A.8.2DORA Art. 9(4)
1-Click IDE Quick Fix
Set privileged: false and drop unnecessary Linux capabilities.
DKR003
Free
CRITICAL
Docker daemon socket (/var/run/docker.sock) mounted
Mounting /var/run/docker.sock into a container enables trivial host root takeover by spawning privileged containers.
CWE-269SOC 2 CC6.3ISO A.8.2DORA Art. 9(4)
Guided Remediation
Remove the docker.sock bind mount or place a strict read-only Docker socket proxy in front of it.
DKR004
Free
MEDIUM
Unpinned container image tag (:latest or missing tag)
Service image uses :latest or omits a version tag/digest, breaking deterministic deployments and increasing supply-chain exposure.
CWE-829SOC 2 CC8.1ISO A.8.8DORA Art. 9(2)
Guided Remediation
Pin an explicit immutable version tag (e.g. postgres:16.4-alpine) or @sha256 digest.
DKR005
Pro
HIGH
Host network mode enabled (network_mode: host)
network_mode: host disables Docker network namespace isolation, exposing all host loopback services to the container.
CWE-668SOC 2 CC6.6ISO A.8.20DORA Art. 9(3)
Guided Remediation
Use an isolated user-defined bridge network and publish only required ports.
DKR006
Pro
HIGH
Dangerous Linux capability added in cap_add
Service adds high-risk Linux capabilities (ALL, SYS_ADMIN, NET_ADMIN, SYS_PTRACE, DAC_OVERRIDE, SYS_MODULE) that allow container escape.
CWE-250SOC 2 CC6.3ISO A.8.2DORA Art. 9(4)
Guided Remediation
Drop ALL capabilities (cap_drop: [ALL]) and add back only minimal non-privileged capabilities if strictly required.
DKR007
Pro
MEDIUM
Missing healthcheck on Docker Compose service
Service does not define a healthcheck, preventing Docker and dependent services from detecting stalled processes.
CWE-755SOC 2 A1.2ISO A.8.14DORA Art. 11
Guided Remediation
Add a healthcheck with test, interval, timeout, and retries.
DKR008
Pro
MEDIUM
Missing restart policy on Docker Compose service
Service lacks a restart policy (or sets restart: 'no'), causing downtime after host reboots or transient crashes.
CWE-755SOC 2 A1.2ISO A.8.14DORA Art. 11
1-Click IDE Quick Fix
Set restart: unless-stopped (or deploy.restart_policy) on production services.
DKR009
Free
CRITICAL
Hardcoded secret or password in Docker Compose environment
A plaintext password, API key, or encryption key is hardcoded in service environment instead of using ${VAR} interpolation or Docker secrets.
CWE-798SOC 2 CC6.1ISO A.5.17DORA Art. 9(4)
1-Click IDE Quick Fix
Use ${VAR:?required} interpolation from an excluded runtime environment or Docker secrets.
DKR010
Pro
MEDIUM
Container runs as root (missing non-root user directive)
Service explicitly runs as root (user: root / 0) or omits a non-root user directive, increasing impact of in-container RCE.
CWE-250SOC 2 CC6.3ISO A.8.2DORA Art. 9(4)
Guided Remediation
Specify an unprivileged UID:GID (e.g. user: "1000:1000") or ensure the image enforces a non-root USER.
DKR011
Pro
MEDIUM
Missing memory limit (mem_limit / deploy.resources.limits.memory)
Service defines no memory ceiling, allowing a memory leak or runaway workflow to trigger host-wide OOM kills.
CWE-770SOC 2 A1.2ISO A.8.6DORA Art. 11
Guided Remediation
Set mem_limit (e.g. 1g) or deploy.resources.limits.memory.
DKR012
Pro
CRITICAL
Sensitive host path bind-mounted into container
Service bind-mounts a sensitive host path (/, /etc, /root, /proc, /sys, ~/.ssh, ~/.aws) into the container.
CWE-732SOC 2 CC6.1ISO A.8.3DORA Art. 9(4)
Guided Remediation
Use named Docker volumes or narrowly scoped application data directories.
DKR013
Pro
MEDIUM
Host PID or IPC namespace shared (pid: host / ipc: host)
Sharing the host PID or IPC namespace lets container processes inspect or signal processes running on the host.
CWE-668SOC 2 CC6.3ISO A.8.22DORA Art. 9(3)
Guided Remediation
Remove pid: host and ipc: host from the service definition.
DKR014
Pro
MEDIUM
Missing no-new-privileges security option
Service does not set security_opt: ['no-new-privileges:true'], allowing processes to gain privileges via setuid/setgid binaries.
CWE-250SOC 2 CC6.3ISO A.8.9DORA Art. 9(4)
Guided Remediation
Add security_opt: ["no-new-privileges:true"] to harden the container.
DKR015
Pro
HIGH
n8n container missing N8N_ENCRYPTION_KEY
An n8n service does not configure N8N_ENCRYPTION_KEY, risking random key regeneration and permanent loss of encrypted credentials on redeploy.
CWE-321SOC 2 CC6.1ISO A.8.24DORA Art. 9(3)
Guided Remediation
Set N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY:?required} using a persistent 32+ char key stored securely.
DKR016
Pro
MEDIUM
Insecure TLS or cookie override in Docker environment
Service environment sets N8N_SECURE_COOKIE=false or NODE_TLS_REJECT_UNAUTHORIZED=0, weakening transport/session security.
CWE-614SOC 2 CC6.7ISO A.8.24DORA Art. 9(3)
1-Click IDE Quick Fix
Set N8N_SECURE_COOKIE=true behind HTTPS and remove NODE_TLS_REJECT_UNAUTHORIZED=0.
DKR017
Pro
LOW
Writable root filesystem (read_only not enabled)
Service does not enable read_only: true, allowing compromised processes to drop binaries or tamper with runtime files.
CWE-732SOC 2 CC6.1ISO A.8.9DORA Art. 9(2)
Guided Remediation
Enable read_only: true with explicit tmpfs or named volumes for writable paths.
DKR018
Pro
LOW
Missing container log rotation (logging.options.max-size)
Service does not configure logging rotation (max-size / max-file), risking host disk exhaustion on noisy production containers.
CWE-770SOC 2 A1.2ISO A.8.6DORA Art. 11
Guided Remediation
Configure logging driver json-file with options max-size: '10m' and max-file: '3'.

Frequently Asked Questions

Does this Docker Compose security checker send my compose file to a backend?

No. StackGuard parses your YAML AST directly inside your browser via scanner-bundle.js. Zero bytes of your docker-compose.yml, environment variables, or service topology are sent over the network.

Why does StackGuard flag ports like 5432:5432 or 6379:6379?

Docker publishes host ports on 0.0.0.0 by default, bypassing common UFW firewall rules on Linux VPS hosts. Rule DKR001 catches exposed database, cache, and admin ports and offers a 1-click IDE Quick Fix to bind strictly to 127.0.0.1.

Does it check self-hosted AI & n8n Docker Compose deployments?

Yes. Beyond container hardening (privileged: true, docker.sock, cap_add, root user, mem_limit, healthcheck, restart policy, no-new-privileges, read_only, log rotation), StackGuard specifically validates n8n production requirements such as N8N_ENCRYPTION_KEY (DKR015) and N8N_SECURE_COOKIE / TLS overrides (DKR016).

How do I run all 18 Docker rules locally in VS Code or CI?

Download the free stackguard-0.2.0.vsix extension for instant Problems-panel diagnostics and 1-click Quick Fixes, or upgrade once to StackGuard Pro ($29 Solo / $49 Team via Polar.sh) to unlock all 72 rules across MCP, n8n, Docker, and Caddy/Traefik with SARIF 2.1.0 and compliance reports.