Ops Docker Security Hardening

Professional strategies for securing containerized applications. Use when this capability is needed.

tomevault-io Updated

File contents

Docker Security Hardening

Containers are not a sandbox by default. You must secure them.

Non-Root Execution

  • Strategy: Always create a user (RUN useradd ...) and switch to them (USER appuser) before the CMD.
  • Reason: Prevents attackers from gaining root access to the host if they compromise the container.

Secret Management

  • Never use ENV for secrets: Use Docker Secrets or mount secrets files at runtime.
  • Read-Only: Mount the root filesystem as read-only whenever possible.

Best Practices

  • Image Scanning: Use docker scout or trivy to identy and fix vulnerabilities.
  • Resource Limits: Set CPU and Memory limits to prevent DoS attacks on the host.

Converted and distributed by TomeVault — claim your Tome and manage your conversions.

tomevault-io/skills-registry/tree/main/jcorpac--ai-skills-library--ops-docker-security-hardening commit 769a1d90a3

Frequently asked questions

npx skillmds@latest add tomevault-io/ops-docker-security-hardening