Résumé
ONYEDIKACHI BERNARDCLOUD · DEVSECOPS · AI
RésuméGet in touch
CASE 29CONTAINERS & KUBERNETES

Docker Hardening and Security Controls

I reviewed the layered security controls available for Docker, from secure daemon access and cgroup resource limits to least-privilege capabilities, seccomp, AppArmor, and image review, and validated each control on a running environment.

Status: REVIEWED · VALIDATED

DOMAIN
Containers & Kubernetes
PLATFORM
Docker, Linux
SEVERITY
Medium
OUTCOME
Layered controls validated

TOOLS

DockerDocker EngineDocker ContextsSSHTLScgroupsDocker InspectLinux CapabilitiescapshSeccompAppArmoraa-statusapparmor_parserDocker ImagesDockerfilesLinux
RESULT
BEFOREControls not assessed
AFTEREach layer reviewed and validated
01

Objective

I set out to review and validate the layered security controls available for Docker containers, covering daemon access, resource limits, capabilities, system call filtering, mandatory access control, and image security.

02

Scenario

A Docker environment needed a security baseline. Rather than focusing on a single weakness, I reviewed each layer of Docker security to understand what controls were available, how they worked, and how to validate them. The goal was to build a practical reference for hardening Docker deployments.

03

What I found

control-layersREVIEW
Daemon access:       SSH contexts and TLS available
Resource limits:     cgroups (CPU/memory) configurable
Capabilities:        Full set by default; drop/add available
Seccomp:             Profiles available but not reviewed
AppArmor:            Profiles loadable via apparmor_parser
Image security:      Dockerfile and layer review possible
FINDING 01MEDIUM

Multiple control layers available but not uniformly applied

The Docker environment had controls available at each layer, but not all were configured or enforced. The review covered six areas: daemon access, resource limits, capabilities, seccomp, AppArmor, and image security.

04

What I did

  1. Reviewed daemon access

    I assessed SSH-based Docker contexts for remote management and TLS for encrypted, authenticated API communication.

  2. Reviewed resource controls

    I inspected cgroup limits for CPU and memory using docker inspect. A value of 0 indicated no limit was configured.

  3. Reviewed capabilities

    I assessed privileged containers versus the recommended approach of dropping all capabilities and adding only specific ones. I used capsh --print to display assigned capabilities.

  4. Reviewed system call filtering

    I assessed seccomp profiles for restricting the system calls available to container processes.

  5. Reviewed mandatory access control

    I assessed AppArmor profiles using aa-status and apparmor_parser for restricting application resource access.

  6. Reviewed image security

    I inspected Dockerfiles and image layers to identify potentially insecure build practices or suspicious commands.

EVIDENCE

TEXT
# Control validation summary
docker context create:  SSH-based remote management configured
docker inspect:         Resource limits reviewed (CPU, memory)
capsh --print:          Capability sets displayed and assessed
aa-status:              AppArmor profiles reviewed
Dockerfile review:      Image layers inspected for insecure practices
05

Validation

Each control layer was reviewed and validated on the running environment:

LAYERCONTROLVALIDATED
Daemon accessSSH contexts, TLSYes
Resource limitscgroups (CPU, memory)Yes
CapabilitiesDrop all, add specificYes
SeccompSystem call restrictionYes
AppArmorResource access restrictionYes
Image securityDockerfile and layer reviewYes
06

Before and after

CONTROLBEFOREAFTER
Daemon accessNot assessedSSH and TLS options validated
Resource limitsNot configured (0)cgroup controls reviewed
CapabilitiesFull set (default)Least-privilege approach documented
SeccompNot assessedProfile application reviewed
AppArmorNot assessedProfile loading and status reviewed
Image securityNot assessedDockerfile and layer review completed
07

What I recommend

  1. 01Use SSH-based Docker contexts or mutual TLS for all remote Docker management, never an unauthenticated TCP socket.
  2. 02Set CPU and memory limits on every container using cgroups to prevent resource exhaustion.
  3. 03Drop all capabilities by default and add only the ones the application needs.
  4. 04Apply seccomp profiles to restrict system calls to the minimum set required.
  5. 05Load and enforce AppArmor profiles to limit what container processes can access on the host.
  6. 06Review Dockerfiles and image layers before deploying, and scan images for known vulnerabilities.

“Docker security is a layered process. Secure daemon access, resource controls, least-privilege capabilities, seccomp, AppArmor, and image review work together to reduce the risk of container compromise and host impact.”

WHAT I LEARNED

SKILLS IT PROVES

  • Docker Security
  • Container Security
  • DevSecOps
  • Linux Security
  • Access Control
  • Least Privilege
  • Security Hardening
  • Vulnerability Assessment
  • Container Runtime Security
  • Linux Capabilities
  • Seccomp
  • AppArmor
  • Resource Management
  • Docker Engine Security
  • Docker Image Security
  • Dockerfile Security
View my labs on GitHub