What Is a Docker Volume and How to Use It
Why a container loses its data when it restarts Write a row to a database running in a Docker container, stop the container, start it again: the row is gone. Every container gets its filesystem fresh from its image each time it starts. Anything the container itself writes — database files, uploads, logs — goes into a writable layer that is thrown away when the container is removed. A Docker volume is how you keep that data outside the container, where it survives. ...