educative.io

Failed running mongo db with volume mount


#1

Failed running mongo db with volume mount,

docker command -
sudo docker run -d -v /home/muralik6/mongo:/data/db mongo

-sh-4.2$ sudo docker logs e07744a09127
find: ‘/data/db’: Permission denied
chown: changing ownership of ‘/data/db’: Permission denied


#2

MongoDB is very picky with the file system as stated here. You can try to use another folder:

sudo docker run -d -v /var/lib/mongo:/data/db mongo

Anyway, that was just an example and you can try volumes with any other images. Please try with MySQL:

docker run -v c:\Temp\mongo:/var/lib/mysql -d mysql:5.7