I am trying to use the Mongo dockerfile to boot up a database, I use the -v command to map a local directory to the data inside the container.
This is how I’m doing it:
RUN mkdir -p /data/db /data/configdb \
&& chown -R mongodb:mongodb /data/db /data/configdb
VOLUME /data/db /data/configdb
But unfortunately I get the following error:
chown: changing ownership of '/data/db': Permission denied
Can someone help me out with this?