MongoDB refuse to start, operation not permitted
A summary of possible solutions are listed below for your convenience:
MongoDB Operation Not Permitted
MongoDB was working perfectly until one day it generated a lock file and stopped starting with the following error:
The corresponding accepted Answer was:
Assuming permissions are correct. It could be an selinux issue, try:
setenforce 0
then try to start the server. If the server starts, you will have to use semanage to set the proper context to the mongo data folder
Windows mounting /data/db
I'm trying to mount /data/db from my Windows dev PC but everytime I try, Mongo crashes as it seems to not have the right BUT :
- I have changed the security parameters in windows to allow everyone to do everything (full access)
- If I mount in a different directory, it works (the container launchs itself and I can write in my directory)
A possible explanation was:
Found a link: VirtualBox Shared Folders are not supported by mongodb.
Apparently one user found a workaround and documented it as:
It works using a volume which is created using docker volume create --name=myvolume The volume name is used instead of the local path. It's just a workaround. To be more precise the line I used in my case :
docker volume create --name=mongodata docker run -d -p 27017:27017 -v mongodata:/data/db --name=mymongo mongodb:3.3
Mongodb with volume doesn't work (Operation not permitted)
The initial person writing the issue had already determined that it wouldn't work and was in search of a solution.
Mongo docs says For example, HGFS and Virtual Box’s shared folders do not support this operation. https://docs.mongodb.com/manual/administration/production-notes/#fsync-on-directories
I wonder if it is possible to make work on current docker for windows.
There was a link in this case that recommeded tuning the mongodb storage engine:
Doesn't docker plan to implemnt something like this?
No, not right now. You might be able to tweak the mongodb storage engine to work on an SMB share: https://forums.docker.com/t/issues-with-mongo-with-mounted-volume-for-data/15085/4
Summary
There are multiple issues surrounding MongoDB and virtual servers on Microsoft Windows, so you might want to consider running your MongoDB in a *nix environment.
Know problem with mongod... It don't work with VirtualBox shared folders. dbPath must be local, NFS, SAN.. Anyway something what is mounted...