read-only root filesystem
Running a container so that nothing in its root filesystem can be changed, with writable space only where you add it.
In more detail
docker run --read-only stops an attacker from dropping tools or altering code in the container. Give the application writable paths explicitly with a tmpfs mount for /tmp or a volume for data.
Example
docker run --read-only --tmpfs /tmp taskapi:0.1Related terms
- tmpfs mount — A mount that keeps files in memory only; they vanish when the container stops.
- least privilege — Giving every program and person only the access they need, and nothing more.
- root filesystem — The top of the directory tree, written as a single slash, under which every other file and directory hangs.
- non-root user — An ordinary user account with limited rights, which a container should run its service as.
- Linux capabilities — Separate pieces of root power, such as binding low ports or changing file owners, that can be granted or removed one by one.
- volume — Storage managed by Docker that lives outside any container, so data survives when the container is removed.
Taught in
- SecurityContexts And Capabilities — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Configuration And Security: Timed Drill And Checkpoint — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Static Analysis: kubesec And KubeLinter — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Immutable Containers: Read-Only At Runtime — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Mock Exam: Seventeen Security Tasks Against The Clock — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Container Hardening: Distroless & Rootless — Cloud Security & DevSecOps Engineering
- Bind Mounts, Permissions And Backups — Docker Architecture & Production Containers
- Environment, Secret Files And Runtime Restrictions — Docker Architecture & Production Containers
- Harden And Deliver The Complete Service Stack — Docker Architecture & Production Containers
- A Pod That Mounts The Node: Runtime, Pods And Storage — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- The Report That Ate The Node: Denial Of Service And Malicious Code — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Four Alerts, One Incident: Observability And The Mesh — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Container Security: Minimal Bases And Non Root — Application Security & Threat Modeling for Engineers
References
- docker container run reference (--read-only)
- OWASP Docker Security Cheat Sheet
- Kubernetes: security context (readOnlyRootFilesystem)