In this article, I will explain how to use Docker volumes for persisting data generated by and used by containers with --mount flag. Volumes use the Docker area and it can be found under /var/lib/docker/volumes/ directory of the Docker host.
docker run -dit --name centos_volume_test --mount source=data_volume01,target=/datavol01 centos sleep 1800
The above command will run a CentOS container and mounts a volume at /datavol01 inside the container. It uses source /var/lib/docker/volumes/data_volume01. The below screenshot shows the necessary steps to verify it.
Hope it was useful. Cheers!
No comments:
Post a Comment