Change Docker Volume storage location

fr flag

Since nearly the beginning, I have used mount binds for persistent data with docker, as the official way of backing up a docker volume is to give it to another container to save it in a tar... Just using rsync on the directory mount seemed much better, but in basically every docker-compose example, volumes are used.

The Documentation states multiple reasons why volumes are so much better, and that you should only use mount binds for configs and so on. As the performance is allegedly also better, I wanted to give it another try, but ran in to the unexpected issue that I can't change where Volumes are stored.

'/var/lib/docker/volumes' may be fine for most users, but I have a separate raid mounted under /mnt for actual data.

How do I define where docker stores volumes?

The answer here is not really clear, as it seems like a complicated bind mount???

I've also found this volume plugin, but I can't believe that docker can't do that on its own.

You can even move the docker root directory, but I am unsure of the implications that this would have, so if anyone has further information on this, let me know.

If the answer is easy, hit me with a hammer and tell me how to do it, because I can't figure it out... Thanks!


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.