Docker Community Forums

Share and learn in the Docker community.

Mounting volume in a container not working


(Johns1) #1

Im on Amazon AWS and can start an image and mount a volume from the root partition, not a problem.

docker run -d -i -t -v /blah/:/blah busybox sh

Inside the container , i can see my files on the host machine in “/test”

However with a mounted disk i have added to the machine, if i mount it, the contents is not visible inside the container.

docker run -i -t -v /mnt/vol1/blah/:/blah busybox sh

Here are the host disks

df

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda1 8123812 7358972 664592 92% /
devtmpfs 2016364 96 2016268 1% /dev
tmpfs 2024936 0 2024936 0% /dev/shm
/dev/xvdf 20511356 45000 19401396 1% /mnt/vol1

I’ve checked the output of docker inspect, and they both look very similar.

    "Mounts": [
        {
            "Source": "/mnt/vol1/blah",
            "Destination": "/blah",
            "Mode": "",
            "RW": true,
            "Propagation": "rprivate"
        }
    ],

Is there some issue im not aware off, such a file system? permissions? or switch you can configure to allow other drives to be mounted in the containers?

Thank you in advance

John


(Johns1) #2

Problem solved.

You have restart the docker daemon to see these mounts on Amazon.