I am trying to mount a host volume to a Docker container for MongoDB. The Dockerfile contains the following.
# Create the MongoDB data directory
RUN mkdir -p /data/db
# Identify mount point
VOLUME /data/db
--> The docker image has a name called mongo.
But when i try to start the image and mount a local Windows folder using:
docker run -d -v /c/Users/310145787/Desktop/mongo:/data/db mongo
I get an error message saying:
invalid value "c:\Users\310145787\Desktop\mongo;C:\Program Files (x86)\Git\data\db" for flag -v: \Users\310145787\Desktop\mongo;C:\Program Files (x86)\Git\data\db is not an absolute path
I checked with boot2docker ssh
if the path is accessible and it seems ok.
docker@boot2docker:/c/Users/310145787/Desktop/mongo
Any clue what is going wrong over here? Or what am i missing?
Using Boot2Docker 1.6, the Dockerfile can be found here
VOLUME /data/db
is for data volume container. If you are mounting an host volume, you shouldn't need theVOLUME
in your Dockerfile. Would the same docker run -v works on an image defined withoutVOLUME
?MKDIR
directive? I mount host folder all the time for docker-compose, and it always work (boot2docker 1.6 on Windows: stackoverflow.com/a/29728993/6309)flag -v: \Users\310145787\Desktop\mongo;C:\Program Files (x86)\Git\data\db is not an absolute path
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Oracle\VirtualBox;c:\prgs\Boot2DockerforWindows
)