Docker Community Forums

Share and learn in the Docker community.

Creating a docker volume at a specified folder on host

Hey guys so I’m having trouble looking around for a solution to my problem. Given these configuration instructions for my digital ocean droplet thats running ubuntu xenial:

ssh root@198.211.99.54
sudo mkfs.ext4 -F /dev/disk/by-id/scsi-0DO_Volume_data
sudo mkdir -p /mnt/data;
sudo mount -o discard,defaults /dev/disk/by-id/scsi-0DO_Volume_data /mnt/data;
echo '/dev/disk/by-id/scsi-0DO_Volume_data /mnt/data ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab

I created a persistent data volume on digital ocean at the directory ‘/mnt/data’. Now, I want to create a docker volume with ‘/mnt/data’ as the file storage location. Something along the lines like:
docker volume create --mountpoint /mnt/data --name data