Docker sq
Docker Fundamentals - Persisting Data

Naming Volumes


Naming Volumes

You can specify a name for a new volume by inserting it followed by a colon and the destination path, like so:

$ docker container run -it --volume [name]:/data [image]:[tag]

You can create files in your new volume very easily:

/ # touch /data/test.file

After deleting a container the volumes remain secure and can still be accessed and loaded into new containers. This is an effective way to preserve the state of your containers.