Linking Local MongoDB Data to Dockerized MongoDB container

I am new to docker and I’m trying to hookup my dockerized mongodb to my local and former data directory located in /data/db and then I saw here that The host machine volume directory cannot be under /Users (or ~). So, I moved my previous /data/db to /Users/ComputerName/Docker/Mongo/data/db and chown the directory to ComputerName and changed the permission to 777 and then ran

docker run -p 27017:27017 -v /Users/ComputerName/Docker/Mongo/data/db:/data/db --name mongo -d mongo mongod --smallfiles and I’m still getting this error below:

  • Build image using docker file?
  • Mount a volume while using a docker container in Azure App Service
  • IDE within docker image?
  • docker-compose not setting environment variables
  • how to split string to array and loop over it?
  • How to run a bash script in an Alpine Docker container
  • chown: changing ownership of '/data/db/_mdb_catalog.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-0--2573889005034950089.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-0-172311321946494465.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-0-5057819112596801042.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-0-7557672013303810902.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-0-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-10-5057819112596801042.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-11-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-13-5057819112596801042.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-13-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-1437-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-1439-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-1441-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-1443-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-1446-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-1450-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-1452-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-1454-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-1456-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-1459-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-15-5057819112596801042.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-15-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-17-5057819112596801042.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-19-5057819112596801042.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-19-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-2-5057819112596801042.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-2-8264987329754823755.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-2059-8691005967059534031.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-2061-8691005967059534031.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-2063-8691005967059534031.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-2066-8691005967059534031.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-2068-8691005967059534031.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-2070-8691005967059534031.wt': Operation not permitted
    chown: changing ownership of '/data/db/collection-2072-8691005967059534031.wt': Operation not permitted
    

  • Fedora 22: ERROR: No module named '_rpmb' while building docker
  • Bluemix very slow to start Spring Boot application, hangs
  • kube-dns can not resolve 'kubernetes.default.svc.cluster.local'
  • Permission Denied while trying to connect to Docker Daemon while running Jenkins pipeline in Macbook
  • Heroku Permission denied: AH00072: make_sock: could not bind to address [::]:80
  • Why docker container exits immediately
  • One Solution collect form web for “Linking Local MongoDB Data to Dockerized MongoDB container”

    Did you changed chmod with -R modifier? You can also try to add Yours account name to docker group.
    – usermod -a -G docker

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.