Checklists

Docker & Containers implementation checklist

This checklist provides actionable verification steps for securing, optimizing, and deploying Docker containers to production environments. It focuses on reducing attack surfaces, ensuring resource availability, and maintaining operational visibility.

Progress0 / 25 complete (0%)

Image Hardening and Optimization

0/5
  • Implement Non-Root User

    critical

    Verify the Dockerfile includes a 'USER' instruction with a specific UID/GID to prevent the container from running as root.

  • Pin Base Image Versions

    critical

    Replace 'latest' tags with specific version numbers or SHA256 digests to ensure build reproducibility and prevent breaking changes.

  • Utilize Multi-Stage Builds

    recommended

    Separate the build environment from the runtime environment to ensure the production image contains only the compiled binary and necessary dependencies.

  • Clean Package Manager Caches

    recommended

    Ensure 'apt-get clean' or equivalent commands are executed within the same 'RUN' layer as package installation to minimize image size.

  • Scan for Vulnerabilities

    critical

    Run an automated scan using Trivy or Docker Scout and verify that no 'Critical' or 'High' severity CVEs exist in the final image.

Resource Management

0/5
  • Define Memory Limits

    critical

    Set hard memory limits (e.g., 'mem_limit' in Compose) to prevent a single container from causing host-wide Out-Of-Memory (OOM) events.

  • Set CPU Reservations

    critical

    Configure CPU limits or shares to ensure the host scheduler provides enough cycles for critical system processes and other containers.

  • Configure Restart Policies

    critical

    Set the restart policy to 'unless-stopped' or 'on-failure' to ensure service availability after crashes or host reboots.

  • Enable Log Rotation

    critical

    Configure the 'json-file' or 'journald' log driver with 'max-size' and 'max-file' options to prevent disk exhaustion from container logs.

  • Set Ulimits

    recommended

    Adjust 'nofile' and 'nproc' ulimits in the container configuration to handle the expected number of concurrent connections or processes.

Networking and Security

0/5
  • Use Custom Bridge Networks

    critical

    Verify that containers are attached to user-defined bridge networks rather than the default bridge to enable automatic DNS resolution and isolation.

  • Restrict Port Exposure

    critical

    Audit the 'EXPOSE' instruction and '-p' flags to ensure only the minimum required ports are accessible to the host or external network.

  • Apply Read-Only Root Filesystem

    recommended

    Run the container with the '--read-only' flag and use temporary volumes for directories requiring write access (e.g., /tmp).

  • Disable Inter-Container Communication

    optional

    Where isolation is required, set '--icc=false' on the Docker daemon or use network aliases to strictly control traffic between services.

  • Enable No-New-Privileges

    recommended

    Set the 'no-new-privileges' security option to prevent processes from gaining new privileges via setuid or setgid binaries.

Storage and Persistence

0/5
  • Use Named Volumes for Persistence

    critical

    Ensure all stateful data is stored in named Docker volumes rather than the container's writable layer to prevent data loss during container recreation.

  • Avoid Bind Mounts in Production

    recommended

    Replace host bind mounts with named volumes or specialized drivers to reduce dependency on specific host filesystem paths.

  • Verify Volume Backup Strategy

    critical

    Test the restoration process of volume data from snapshots or off-site backups to ensure business continuity.

  • Clean Up Unused Volumes

    optional

    Implement a routine 'docker volume prune' or manual audit to reclaim disk space from orphaned volumes.

  • Set Volume Mount Permissions

    recommended

    Explicitly set the ':ro' (read-only) flag on volume mounts that the container should not have permission to modify.

Runtime and Observability

0/5
  • Define Healthchecks

    critical

    Include a 'HEALTHCHECK' instruction that verifies the application is actually serving requests, not just that the process is running.

  • Handle SIGTERM Gracefully

    critical

    Verify the application responds to SIGTERM by closing database connections and finishing active requests within the stop grace period.

  • Externalize Secrets

    critical

    Confirm no secrets (API keys, passwords) are stored in environment variables visible to 'docker inspect'; use Docker Secrets or a Vault provider.

  • Standardize Logging

    critical

    Ensure the application logs exclusively to stdout and stderr to allow the Docker daemon to capture and forward logs to a central aggregator.

  • Use .dockerignore

    critical

    Verify a .dockerignore file exists to prevent sensitive local files (.env, .git, SSH keys) from being copied into the image build context.