mongo: can not use external volume

Several people reported this problem on Docker mongo repo.

I experience the same issue. I am running in vagrant latest with docker v1.5.0, my system is Linux ubuntu-14 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux.

I downloaded the latest mongo build v3.0.0 via docker pull mongo. Then I run docker run -it -v ~/shared/mongodb/data:/data/db mongo:latest, I got an error below

2015-03-19T05:04:59.871+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=715c517cfbb7
2015-03-19T05:04:59.872+0000 I CONTROL  [initandlisten]
2015-03-19T05:04:59.872+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-03-19T05:04:59.872+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-03-19T05:04:59.872+0000 I CONTROL  [initandlisten]
2015-03-19T05:04:59.872+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-03-19T05:04:59.872+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-03-19T05:04:59.872+0000 I CONTROL  [initandlisten]
2015-03-19T05:04:59.872+0000 I CONTROL  [initandlisten] db version v3.0.0
2015-03-19T05:04:59.873+0000 I CONTROL  [initandlisten] git version: a841fd6394365954886924a35076691b4d149168
2015-03-19T05:04:59.873+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
2015-03-19T05:04:59.873+0000 I CONTROL  [initandlisten] build info: Linux ip-10-171-101-151 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 BOOST_LIB_VERSION=1_49
2015-03-19T05:04:59.873+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2015-03-19T05:04:59.873+0000 I CONTROL  [initandlisten] options: {}
2015-03-19T05:04:59.887+0000 I STORAGE  [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2015-03-19T05:04:59.887+0000 I CONTROL  [initandlisten] dbexit:  rc: 100

If I do not run with volume, it works fine.

I have talked to the MongoDB support tech support. They said the issue is You do not have the permission to write to volume "/data/db" inside container. It is definitely a permission issue. How could I solve smartly??

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 20 (5 by maintainers)

Most upvoted comments

@yosifkit should I give an issue to mongodb about this? and yeah, after upgrade on other machines, think we have to change about our workflow developing osx+docker1.8+mongodb

after docker-machine ssh dev (which is in virtualbox), then i tried running mongodb container on it, it worked… I guess i have some issues mounting dir from osx…