Docker Volume

#202203251354 stores its volume or storage under the directory /var/lib/docker/volume. Such volume could be created using the command docker volume create.

Docker could attach a Docker Volume or an external directory to a 202203281423 using the option -v in docker run. Attaching a Docker Volume to a container is call **volume mount** with the format {volume-name}/{path}whereas attaching an external directory to a container is call **bind mount**{dir-path}/{path}`.

For it to be more verbose, we could specify it with the --mount option like --mount type=bind,source=/data/mysql,target=/var/lib/mysql where type specify what is the type of mounting is using, source specify the volume name or the external directory path depending on the mount type and target specify the targeted path where the data stored.

There are a variety of storage drivers that Docker supported: aufs, ZFS, btrfs, Device Mapper, Overlay and Overlay2. See more in 202202060057.

Links to this page
#container