Q1
How does Docker construct image layers, and how does the OverlayFS union file system work under the hood?
💬Answer
Docker images are constructed as a stack of read-only layers. Each instruction in a Dockerfile (e.g., RUN, COPY, ADD) creates a new layer.
- Union File System: Merges all read-only layers into a single, unified filesystem view.
- Copy-On-Write (CoW): When a running container modifies a file in a read-only layer, Docker copies the file to the writable container layer before applying the edits, leaving the underlying image layers unchanged.
- OverlayFS: The union filesystem driver used by Docker. It combines:
Lowerdir: The read-only image layers.Upperdir: The writable container layer containing modifications.Merged: The combined view presented to the running container process.
Related Docker Questions
View All DockerQuestions →Q1
How would you explain the difference between a container and a virtual machine to someone new to DevOps?
Q2What is Docker, and what specific advantages does it bring to the software development lifecycle?
Q3Can you walk me through the low-level container runtime stack (runc, containerd, CRI-O)? What actually happens under the hood when 'docker run' executes?
Q4# Execution flow of `docker run`:

Created by
Apurv Gujjar
DevOps & Cloud Engineer
Specialized in:DevOpsAWSGCPKubernetesTerraformDocker
View Portfolio