3

Docker can't modify base image's filesystem, but can't copy it. How can store its changes during container usage? I see that it stores files under /var/lib/docker, but how can store filesys' changes without modifying it? What is the methodology?

1 Answer 1

3

It does store changes through a new filesystem layer, because of its copy-on-write mechanism:

https://www.softnas.com/wp/wp-content/uploads/2014/06/Feature-COW-Full.png

Those changes disappear after a docker rm (unless you docker commit right after a docker stop)

If you want some persistence, you would need to use a volume or use a data volume container.

When doing a docker run, you can mount a volume from your host or mount one from a data container.

Sign up to request clarification or add additional context in comments.

Comments