I'm trying to use the official Mongo dockerfile to load the database, I use the -v command to map the local to / data directory inside the container.
As part of the docker file, it tries to use this directory for the mongodb user:
RUN mkdir -p /data/db /data/configdb \
&& chown -R mongodb:mongodb /data/db /data/configdb
VOLUME /data/db /data/configdb
However, this is not performed with the following command:
chown: changing ownership of '/data/db': Permission denied
What am I doing wrong here? I can not find any documentation about this - of course, the container must have full access rights to the mapped directory, since it was explicitly passed in the docker launch command:
docker run -d --name mongocontainer -v R:\mongodata:/data/db -p 3000:27017 mongo:latest
James source
share