On a windows 7 system, using docker 1.9.1 and VirtualBox 5.0.16, the docker image refuses to start when using the volume command as listed on the Docker Hub page.
$ docker run --name mongo-db -v //c/Users/Dieter/some-folder/DB:/data/db -d
mongo:3.2.4
f9661fcd48eba45671b96a0efd850851b7de846a535d910f72bb969cfdb09845
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
$ docker logs mongo-db
2016-03-20T16:22:38.194+0000 I CONTROL [initandlisten] MongoDB starting : pid=1
port=27017 dbpath=/data/db 64-bit host=f9661fcd48eb
2016-03-20T16:22:38.194+0000 I CONTROL [initandlisten] db version v3.2.4
2016-03-20T16:22:38.194+0000 I CONTROL [initandlisten] git version: e2ee9ffcf9f
5a94fad76802e28cc978718bb7a30
2016-03-20T16:22:38.194+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL
1.0.1e 11 Feb 2013
2016-03-20T16:22:38.194+0000 I CONTROL [initandlisten] allocator: tcmalloc
2016-03-20T16:22:38.194+0000 I CONTROL [initandlisten] modules: none
2016-03-20T16:22:38.194+0000 I CONTROL [initandlisten] build environment:
2016-03-20T16:22:38.194+0000 I CONTROL [initandlisten] distmod: debian71
2016-03-20T16:22:38.194+0000 I CONTROL [initandlisten] distarch: x86_64
2016-03-20T16:22:38.194+0000 I CONTROL [initandlisten] target_arch: x86_64
2016-03-20T16:22:38.194+0000 I CONTROL [initandlisten] options: {}
2016-03-20T16:22:38.200+0000 I STORAGE [initandlisten] wiredtiger_open config:
create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=fals
e,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snapp
y),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),stati
stics_log=(wait=0),
2016-03-20T16:22:38.209+0000 E STORAGE [initandlisten] WiredTiger (1) [14584909
58:209969][1:0x7efcc0cffc80], connection: /data/db/WiredTiger.wt: Operation not
permitted
2016-03-20T16:22:38.211+0000 I - [initandlisten] Assertion: 28595:1: Oper
ation not permitted
2016-03-20T16:22:38.213+0000 I STORAGE [initandlisten] exception in initAndList
en: 28595 1: Operation not permitted, terminating
2016-03-20T16:22:38.213+0000 I CONTROL [initandlisten] dbexit: rc: 100
The same errors occur for 3.2 and 3. For 2.6.11, the error is different:
$ docker run --name mongo-db -v //c/Users/Dieter/some-folder/DB2:/data/db -d
mongo:2.6.11
6ec106edab731d05b4319018ef7eb16889ff1f2d80843e59ad78deb1e2e2c255
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
$ docker logs mongo-db
mongod --help for help and startup options
2016-03-20T16:30:34.795+0000 [initandlisten] MongoDB starting : pid=1 port=27017
dbpath=/data/db 64-bit host=6ec106edab73
2016-03-20T16:30:34.795+0000 [initandlisten] db version v2.6.11
2016-03-20T16:30:34.795+0000 [initandlisten] git version: d00c1735675c457f75a12d
530bee85421f0c5548
2016-03-20T16:30:34.795+0000 [initandlisten] build info: Linux build4.ny.cbi.10g
en.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_
LIB_VERSION=1_49
2016-03-20T16:30:34.795+0000 [initandlisten] allocator: tcmalloc
2016-03-20T16:30:34.796+0000 [initandlisten] options: {}
2016-03-20T16:30:34.799+0000 [initandlisten] WARNING: This file system is not
supported. For further information see:
2016-03-20T16:30:34.799+0000 [initandlisten] http://dochub.mo
ngodb.org/core/unsupported-filesystems
2016-03-20T16:30:34.799+0000 [initandlisten] Please notify MongoDB, I
nc. if an unlisted filesystem generated this warning.
2016-03-20T16:30:34.800+0000 [initandlisten] journal dir=/data/db/journal
2016-03-20T16:30:34.802+0000 [initandlisten] recover : no journal files present,
no recovery needed
2016-03-20T16:30:34.812+0000 [initandlisten] info preallocateIsFaster couldn't r
un due to: couldn't open file /data/db/journal/tempLatencyTest for writing errno
:1 Operation not permitted; returning false
2016-03-20T16:30:34.814+0000 [initandlisten] Unable to remove temporary file due
to: boost::filesystem::remove: Text file busy: "/data/db/journal/tempLatencyTes
t"
2016-03-20T16:30:34.817+0000 [initandlisten] exception in initAndListen: 13516 c
ouldn't open file /data/db/journal/j._0 for writing errno:1 Operation not permit
ted, terminating
2016-03-20T16:30:34.817+0000 [initandlisten] dbexit:
2016-03-20T16:30:34.817+0000 [initandlisten] shutdown: going to close listening
sockets...
2016-03-20T16:30:34.817+0000 [initandlisten] shutdown: going to flush diaglog...
2016-03-20T16:30:34.817+0000 [initandlisten] shutdown: going to close sockets...
2016-03-20T16:30:34.818+0000 [initandlisten] shutdown: waiting for fs preallocat
or...
2016-03-20T16:30:34.818+0000 [initandlisten] shutdown: lock for final commit...
2016-03-20T16:30:34.818+0000 [initandlisten] shutdown: final commit...
2016-03-20T16:30:34.818+0000 [initandlisten] shutdown: closing all files...
2016-03-20T16:30:34.818+0000 [initandlisten] closeAllFiles() finished
2016-03-20T16:30:34.818+0000 [initandlisten] journalCleanup...
2016-03-20T16:30:34.818+0000 [initandlisten] removeJournalFiles
2016-03-20T16:30:34.819+0000 [initandlisten] warning exception removing /data/db
/journal/j._0: boost::filesystem::remove: Text file busy: "/data/db/journal/j._0
"
2016-03-20T16:30:34.821+0000 [initandlisten] Assertion failure !haveJournalFiles
() src/mongo/db/dur_journal.cpp 258
2016-03-20T16:30:34.827+0000 [initandlisten] 0x121d451 0x11bcbb9 0x11a1124 0xa77
2f8 0xa77829 0xba838f 0xba903c 0x76f7d4 0x76fc95 0x76ff69 0x7f020dd79ead 0x76652
9
mongod(_ZN5mongo15printStackTraceERSo+0x21) [0x121d451]
mongod(_ZN5mongo10logContextEPKc+0x159) [0x11bcbb9]
mongod(_ZN5mongo12verifyFailedEPKcS1_j+0x194) [0x11a1124]
mongod(_ZN5mongo3dur18removeJournalFilesEv+0x8a8) [0xa772f8]
mongod(_ZN5mongo3dur7Journal7cleanupEb+0x49) [0xa77829]
mongod() [0xba838f]
mongod(_ZN5mongo6dbexitENS_8ExitCodeEPKc+0x18c) [0xba903c]
mongod(_ZN5mongo13initAndListenEi+0x1a4) [0x76f7d4]
mongod() [0x76fc95]
mongod(main+0x9) [0x76ff69]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd) [0x7f020dd79ead]
mongod() [0x766529]
2016-03-20T16:30:34.827+0000 [initandlisten] error couldn't remove journal file
during shutdown assertion src/mongo/db/dur_journal.cpp:258
2016-03-20T16:30:34.828+0000 [initandlisten] SEVERE: shutdown failed with except
ion
2016-03-20T16:30:34.828+0000 [initandlisten] dbexit: really exiting now
Where both files in the journal folder are still locked by the VM.
Running without the docker volume command works.