Repository navigation
Closed
Description
The following command fails:
% docker run -it --rm -v ${PWD}/db:data/db mongo:3.6-jessie
2018-01-26T17:08:45.414+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=0c2777f39bd4
2018-01-26T17:08:45.415+0000 I CONTROL [initandlisten] db version v3.6.2
2018-01-26T17:08:45.415+0000 I CONTROL [initandlisten] git version: 489d177dbd0f0420a8ca04d39fd78d0a2c539420
2018-01-26T17:08:45.415+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t 3 May 2016
2018-01-26T17:08:45.415+0000 I CONTROL [initandlisten] allocator: tcmalloc
2018-01-26T17:08:45.415+0000 I CONTROL [initandlisten] modules: none
2018-01-26T17:08:45.415+0000 I CONTROL [initandlisten] build environment:
2018-01-26T17:08:45.415+0000 I CONTROL [initandlisten] distmod: debian81
2018-01-26T17:08:45.415+0000 I CONTROL [initandlisten] distarch: x86_64
2018-01-26T17:08:45.415+0000 I CONTROL [initandlisten] target_arch: x86_64
2018-01-26T17:08:45.415+0000 I CONTROL [initandlisten] options: { net: { bindIpAll: true }, storage: { dbPath: "/data/db" } }
2018-01-26T17:08:45.416+0000 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-01-26T17:08:45.416+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=3419M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2018-01-26T17:08:45.432+0000 E STORAGE [initandlisten] WiredTiger error (1) [1516986525:432513][1:0x7fbba23e3a00], file:WiredTiger.wt, connection: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted
2018-01-26T17:08:45.433+0000 E - [initandlisten] Assertion: 28595:1: Operation not permitted src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 413
2018-01-26T17:08:45.436+0000 I STORAGE [initandlisten] exception in initAndListen: Location28595: 1: Operation not permitted, terminating
2018-01-26T17:08:45.436+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2018-01-26T17:08:45.436+0000 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2018-01-26T17:08:45.436+0000 I CONTROL [initandlisten] now exiting
2018-01-26T17:08:45.436+0000 I CONTROL [initandlisten] shutting down with code:100The path ${PWD}/db is located to an NTFS drive.
It seems to be a known issue around the NTFS support over mounted volumes (#190 for example).
However, what I can't explain is the following (that works!):
% docker run -it --rm -v $PWD/db:/data/db mongo:3.6-jessie /bin/bash
% mongod --dbpath /data/db
2018-01-26T17:40:26.701+0000 I CONTROL [initandlisten] MongoDB starting : pid=7 port=27017 dbpath=/data/db 64-bit host=d904a58096a3
2018-01-26T17:40:26.702+0000 I CONTROL [initandlisten] db version v3.6.2
2018-01-26T17:40:26.702+0000 I CONTROL [initandlisten] git version: 489d177dbd0f0420a8ca04d39fd78d0a2c539420
2018-01-26T17:40:26.702+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t 3 May 2016
2018-01-26T17:40:26.702+0000 I CONTROL [initandlisten] allocator: tcmalloc
2018-01-26T17:40:26.702+0000 I CONTROL [initandlisten] modules: none
2018-01-26T17:40:26.702+0000 I CONTROL [initandlisten] build environment:
2018-01-26T17:40:26.702+0000 I CONTROL [initandlisten] distmod: debian81
2018-01-26T17:40:26.702+0000 I CONTROL [initandlisten] distarch: x86_64
2018-01-26T17:40:26.702+0000 I CONTROL [initandlisten] target_arch: x86_64
2018-01-26T17:40:26.702+0000 I CONTROL [initandlisten] options: { storage: { dbPath: "/data/db" } }
2018-01-26T17:40:26.704+0000 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-01-26T17:40:26.704+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=3419M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2018-01-26T17:40:31.417+0000 I STORAGE [initandlisten] WiredTiger message [1516988431:417429][7:0x7fb440362a00], txn-recover: Main recovery loop: starting at 4/4736
2018-01-26T17:40:31.521+0000 I STORAGE [initandlisten] WiredTiger message [1516988431:521303][7:0x7fb440362a00], txn-recover: Recovering log 4 through 5
2018-01-26T17:40:31.615+0000 I STORAGE [initandlisten] WiredTiger message [1516988431:615200][7:0x7fb440362a00], txn-recover: Recovering log 5 through 5
2018-01-26T17:40:32.260+0000 I CONTROL [initandlisten]
2018-01-26T17:40:32.261+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-01-26T17:40:32.261+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-01-26T17:40:32.261+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2018-01-26T17:40:32.261+0000 I CONTROL [initandlisten]
2018-01-26T17:40:32.261+0000 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-01-26T17:40:32.261+0000 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2018-01-26T17:40:32.261+0000 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2018-01-26T17:40:32.261+0000 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-01-26T17:40:32.261+0000 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-01-26T17:40:32.261+0000 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-01-26T17:40:32.261+0000 I CONTROL [initandlisten]
2018-01-26T17:40:32.290+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2018-01-26T17:40:32.290+0000 I NETWORK [initandlisten] waiting for connections on port 27017Do you have an explanation on this?
If there is an issue with the NTFS support, why does it works when entering the container directly?
Metadata
Metadata
Assignees
Labels
No labels
Activity
tianon commentedon Jan 26, 2018
Duplicate of #205.
bhamon commentedon Jan 26, 2018
This issue is in contradiction with #205.
The autostart command fails (
mongod), but with the same NTFS volume mounted I got it to work with a simplemongodcall from inside the container.tianon commentedon Jan 26, 2018
Oh, interesting quirk! Investigating now!
tianon commentedon Jan 26, 2018
Oh, the difference is root vs non-root. When you run
mongoddirectly from thebashshell, it's running as root and thus has permission to access the NTFS filesystem. It also works if you mount the NTFS partition as the target user directly:bhamon commentedon Jan 28, 2018
Based on your comment I derived your Dockerfile by adding a
USER rootinstruction and it works like a charm.norbertherbert commentedon Feb 15, 2018
It does not work for me :-(
Instead of "Operation not permitted" error I get "fdatasync: Invalid argument" error.
`
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\Users\user01> docker run -it --rm -v $PWD/data/db:/data/db mongo:3.6-jessie /bin/bash
root@adb5d976df7f:/# mongod --dbpath /data/db
2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] MongoDB starting : pid=7 port=27017 dbpath=/data/db 64-bit host=adb5d976df7f
2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] db version v3.6.2
2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] git version: 489d177dbd0f0420a8ca04d39fd78d0a2c539420
2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t 3 May 2016
2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] allocator: tcmalloc
2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] modules: none
2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] build environment:
2018-02-15T10:08:02.495+0000 I CONTROL [initandlisten] distmod: debian81
2018-02-15T10:08:02.496+0000 I CONTROL [initandlisten] distarch: x86_64
2018-02-15T10:08:02.496+0000 I CONTROL [initandlisten] target_arch: x86_64
2018-02-15T10:08:02.496+0000 I CONTROL [initandlisten] options: { storage: { dbPath: "/data/db" } }
2018-02-15T10:08:02.503+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=478M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2018-02-15T10:08:02.559+0000 E STORAGE [initandlisten] WiredTiger error (17) [1518689282:559261][7:0x7f25b832ca00], connection: /data/db/WiredTiger.wt: handle-open: open: File exists
2018-02-15T10:08:02.566+0000 I STORAGE [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.2
2018-02-15T10:08:02.567+0000 E STORAGE [initandlisten] WiredTiger error (22) [1518689282:567535][7:0x7f25b832ca00], connection: /data/db/: directory-sync: fdatasync: Invalid argument
2018-02-15T10:08:02.570+0000 F - [initandlisten] Fatal Assertion 28561 at src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 410
2018-02-15T10:08:02.570+0000 F - [initandlisten]
***aborting after fassert() failure
root@adb5d976df7f:/#
`
yosifkit commentedon Feb 15, 2018
@norbertherbert, if you are using Docker for Windows or Boot2Docker it will not work to share a volume from the Windows host to the Linux container VM.
With Linux containers on Windows, you cannot use a volume mapped to the host (bind mount that is shared from VM to host) and instead must use a named volume to persist your database. You can use native Windows Docker containers on Windows 10 Pro (like
mongo:3.6-windowsservercore), but they are not currently being updated since #241.This issue is about accessing an NTFS mount on a Linux host and it turns out, it was just a permissions issue. As such, it is solved and so I'll close.
reuwi commentedon Jun 6, 2018
@yosifkit So is there any solution or workaround to use volume mapped in win?