How to store MongoDB data with docker-compose
Actually it's the other way around (HOST:CONTAINER), /data/mongodb/db
is on your host machine and /data/db
is in the container.
You have added the /data
in the shared folders of your dev machine but you haven't created /data/mongodb/db
, that's why you get a permission denied
error. Docker doesn't have the rights to create folders.