Impact & Risk Analysis
- Severity: High
- CIS Benchmark: CIS 5.13
- Impact: Malware Persistence & Tampering. The container’s root filesystem should be treated as a ‘golden image’. If it is writable, an attacker who compromises the container can modify system binaries, install malware, or alter configuration files. Mounting the root filesystem as read-only reduces these attack vectors since the filesystem cannot be tampered with.
Common Misconfiguration
Running containers with the default writable root filesystem. This allows any process inside the container to modify files, violating the principle of immutable infrastructure.Vulnerable Example
Secure Example
Audit Procedure
Run the following command on the Docker host:- Result: Check the
ReadonlyRootfsvalue. - Fail: If it returns
false, the root filesystem is writable. - Pass: If it returns
true.
Remediation
You should add a--read-only flag at a container’s runtime to enforce the container’s root filesystem being mounted as read-only.
Since many applications need to write temporary files (like logs, PID files, or caches), you must explicitly define these writable locations using:
--tmpfs: For temporary, non-persistent data (e.g.,/tmp,/run).- Volumes (
-v): For persistent data that needs to be saved (e.g.,/app/data).

