Docker Community Forums

Share and learn in the Docker community.

Mount external drive to a volume and attach it to a container


(Ezspam) #1

I have an external drive mounted on the following path
I am trying to make this external drive as my named volume container to store the data. The application stores as all the data in /var/www/html/

I am guessing I have to create a volume container for the external drive and attach the same when I running the application container. I normally follow the below format . I am lost on how to make this happen in this case. Any help is appreciated.

docker create -v <>:path --name <> arm32v6/alpine:latest

docker run -d -v <>:path --name <> --volumes-from <> arm32v7/nextcloud

(Sam) #2

you don’t need volumes-from unless it is ANOTHER volume in addition to the named volume
the volume create has nothing to do with a container

docker volume create --name fred /media/pi/mydrive    <--- only do once
docker run -v fred:/var/www/html/

(Ezspam) #3

I did try the docker volume create command but am getting the following error

Conflicting options: either specify --name or provide positional arg, not both

(Sam) #4

sorry, I got the syntax wrong…

you will need to use the --opt parm to specify the source path

see the doc

(Ezspam) #5

Thanks very much. It works now :slight_smile: