Docker sq
Docker Fundamentals - Persisting Data

Naming Volumes

Mute
Current Time 0:00
/
Duration Time 0:00
Loaded: 0%
Progress: 0%
Stream TypeLIVE
Remaining Time -0:00
 
PRO

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.

 

I finished! On to the next chapter