Skip to content
Advertisement

Docker mount volume specify path

please I really need help creating a docker volume.

By default, when I create a volume, its location will be /var/lib/docker/volumes/

I need to change this default location to my SSD disk, specifically /media/username/T7/docker/volumes

Please how do I make sure the docker I run will be stored in my SSD rather than the default location?

I will be using this docker run command

docker run 
    --detach 
    --publish 1848:1848 
    --publish 1789:1789 
    --name chainweb-node 
    --mount type=volume,source=chainweb-data,target=/data 
    kadena/chainweb-node

Thank you so much. I am really loosing it here trying to work with Linux.

Advertisement

Answer

Provide the full path.

docker run 
    --detach 
    --publish 1848:1848 
    --publish 1789:1789 
    --name chainweb-node 
    --mount type=bind,source=/media/username/T7/docker/volumes,target=/data 
    kadena/chainweb-node

This assumes the directory already exists on your host. Make sure to make and mount it.

Documentation on Docker Volumes: https://docs.docker.com/storage/volumes/

Possible Duplicate: Creating a Docker volume at a specific location

Same answer from Docker forum: https://forums.docker.com/t/how-to-make-volume-on-a-specific-path/92694/8

Similar question on Unix stack exchange: https://unix.stackexchange.com/questions/439106/docker-create-a-persistent-volume-in-a-specific-directory

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement