Search code examples
dockerdocker-composedocker-volume

Create docker volume in directory


It is possible to create docker volume in my destined directory?

I was not able to found it in documentation, I just saw some mountpoints, but I want to mount it localy, from my defined directory. For example /data/docker/volume_name/

docker volume create won't let me do that.


Solution

  • I don't have enough reputation to comment or flag, but I think your question is already answered here: Docker: change folder where to store docker volumes

    In short, see this part of the top answer by BMitch:

    docker volume create --driver local \
      --opt type=none \
      --opt device=/home/user/test \
      --opt o=bind \
      test_vol