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:

  • Run a script into a container then copy files to host from the container
  • I am trying to perform mvn install from Dockerfile but it is not working says mvn not found
  • Volume mapped filebeat.yml permissions from Docker on a Windows host
  • `docker service update` from remote server with cert
  • Docker Volume Access Error
  • Docker: Development environments [closed]
  • 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
    

  • Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
  • Docker pull fails with “Tag latest not found in repository” even when “latest” tag exists
  • automatically start /etc/init script in IBM Bluemix container
  • Docker toolbox volumes on windows doesn't refresh changes on container
  • Docker Compose V2 network error
  • Docker is not adding a network shared folder as a data volume
  • 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.