Storage
In this lesson, you will learn how to store your data in a persistent file system.
As we saw in the Using Volumes lesson, it’s better to create images that result in stateless containers that rely on external data stores. Sometimes though, you need to store your data in a persistent file system.
When this need arises, use the VOLUME instruction as such:
The /path/to/directory is a path to a directory used inside the image. When a container is created using the docker run command, the -v switch can be used to map this directory to an actual volume on the host system.
This is only an indication. By default, if the user doesn’t map this volume to an external store for the container, the data will be stored inside the container.
In the next lesson, we will learn how to use the EXPOSE instruction.