Docker Community Forums

Share and learn in the Docker community.

Mount a host directory as a data volume which is mounted to another partition


(Mogadanez) #1

Have two partitions: root ( 5GB ) and second ( 100GB ) mounted as /mnt/storage to host

How can I set **/mnt/storage **to accessible inside container?
I tried
docker run -v /mnt/storage:/tmp/cache image:latest bash
but it is not work ( not see files that placed in hosts /mnt/storage and df - h /tmp/cache shown only 5G total space )

(Ecardoso) #2

Apparently docker mounts the directory on which you mounted your partition and not the partition itself. Have you tried mounting a folder that is in partition?
e.g.: docker run -v /mnt/storage/cache:/tmp/cache image:latest bash

(Mogadanez) #3

Looks like problem is in order.
In my case mount happens after docker start.
If I restart docker - all works fine
30 Ноя 2015 г. 21:34 пользователь “Ecardoso”