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
TOOLS
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.
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.
What I found
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 possibleMultiple 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.
What I did
- Reviewed daemon access
I assessed SSH-based Docker contexts for remote management and TLS for encrypted, authenticated API communication.
- Reviewed resource controls
I inspected cgroup limits for CPU and memory using
docker inspect. A value of0indicated no limit was configured. - Reviewed capabilities
I assessed privileged containers versus the recommended approach of dropping all capabilities and adding only specific ones. I used
capsh --printto display assigned capabilities. - Reviewed system call filtering
I assessed seccomp profiles for restricting the system calls available to container processes.
- Reviewed mandatory access control
I assessed AppArmor profiles using
aa-statusandapparmor_parserfor restricting application resource access. - Reviewed image security
I inspected Dockerfiles and image layers to identify potentially insecure build practices or suspicious commands.
EVIDENCE
# 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 practicesValidation
Each control layer was reviewed and validated on the running environment:
| LAYER | CONTROL | VALIDATED |
|---|---|---|
| Daemon access | SSH contexts, TLS | Yes |
| Resource limits | cgroups (CPU, memory) | Yes |
| Capabilities | Drop all, add specific | Yes |
| Seccomp | System call restriction | Yes |
| AppArmor | Resource access restriction | Yes |
| Image security | Dockerfile and layer review | Yes |
Before and after
| CONTROL | BEFORE | AFTER |
|---|---|---|
| Daemon access | Not assessed | SSH and TLS options validated |
| Resource limits | Not configured (0) | cgroup controls reviewed |
| Capabilities | Full set (default) | Least-privilege approach documented |
| Seccomp | Not assessed | Profile application reviewed |
| AppArmor | Not assessed | Profile loading and status reviewed |
| Image security | Not assessed | Dockerfile and layer review completed |
What I recommend
- 01Use SSH-based Docker contexts or mutual TLS for all remote Docker management, never an unauthenticated TCP socket.
- 02Set CPU and memory limits on every container using cgroups to prevent resource exhaustion.
- 03Drop all capabilities by default and add only the ones the application needs.
- 04Apply seccomp profiles to restrict system calls to the minimum set required.
- 05Load and enforce AppArmor profiles to limit what container processes can access on the host.
- 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.”
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