- docker volume create --name <volume_name> # Creates a volume called <volume_name>
- docker run -v <volume_name>:<mount_point> -d crramirez/limesurvey:latest # Mount the <volume_name> volume in <mount_point> directory in the container
|--name <volume_name>||Specify the volume name to be created|
|-v <volume_name>:<mount_point>||Specify where the named volume will be mounted in the container|
Persistence is created in docker containers using volumes. Docker have many ways to deal with volumes.
Named volumes are very convenient by:
- They persist even when the container is removed using the -v option.
- The only way to delete a named volume is doing an explicit call to docker volume rm
- The named volumes can be shared among container without linking or --volumes-from option.
- They don't have permission issues that host mounted volumes have.
- They can be manipulated using docker volume command.