0

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.

masch1na
  • 97
  • 5

1 Answers1

2

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

lwileczek
  • 2,084
  • 18
  • 27
  • I was so optimistic when I saw your quick response, but unfortunately this doesn't work because Linux hates everything that works. I got the following error.. ``` docker: Error response from daemon: create /media/username/T7/docker/volumes: "/media/username/T7/docker/volumes" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path. ``` I should be using absolute path already, I checked with readlink command... Any ideas good sir? – masch1na Nov 18 '22 at 16:09
  • The issue is the type volume. You can either use -v, --volume, or type=bind – lwileczek Nov 18 '22 at 17:43
  • I used bind and it seems to be working. Thank you so much for saving me from this insanity – masch1na Nov 18 '22 at 17:57