Ref: https://learn.cantrill.io/courses/docker-fundamentals/lectures/44151338 =OR= https://www.youtube.com/watch?v=OAeVsjwRVe8
Writable Layer
- 🔧 Container data changes during runtime are stored by default in this layer
- other storage options need extra configuration
- Requires a file system driver
- Has overhead
- Impacts performance (while container is running)
- Linked to container's lifecycle → does not persist when container is deleted
- stopping container keeps the layer and eliminates performance hit
- Union File System overlays files and directories from separate file systems
- End result: a “single” file system
- Data tightly coupled with the host → data cannot be easily moved
- Summary diagram
Temporary File System (tmpfs or tempfs)
- 🔧 One tmpfs volume can be mounted per container
- Can't be shared between containers
- Uses host memory → very fast
- Ephemeral (not persistent)
- Useful for temporary or sensitive files of short usage that shouldn't be stored in disk
Bind Mounts
- 🔧 Map external directory to a container directory
- External directory can be in the host machine or even remote
- Persistent
- Persist after container deletion
- Can be moved between containers
- One container can have multiple bind mounts
- Multiple containers can access the same bind mount/external directory
- ‼️ No file locking → extra IO/RW management to make sure data doesn't get corrupted!