How to store a specific named docker volume at a specific location without changing the default?

一笑奈何 提交于 2019-12-07 03:36:01

问题


I would like to create a named volume for one of my containers.

This container will need a lot more storage than other containers I run, so I would like to store that particular volume on a different disk that has lots of free space.

I still want the other volumes on the default disk, only that one named volume should go on another disk.

I don't want to use a bind mount because it will make backing up and migrating more complicated.

The only option I can think of is to manually move the volume after it is created (while the container is stopped), and create a symlink from its original location in /var/lib/docker/... to the new location on the other hard drive. This is very manual though, which leads me to think there must be a better way.

What is the recommended way of achieving this?


回答1:


Use the local volume driver:

docker volume create -d local -o type=none -o o=bind -o device=/host/path volname

(Taken from this github comment)



来源:https://stackoverflow.com/questions/47784863/how-to-store-a-specific-named-docker-volume-at-a-specific-location-without-chang

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!