Giter Site home page Giter Site logo

mongo's People

Contributors

awakecoding avatar davidau avatar docker-library-bot avatar eduardocardoso avatar gianpaj avatar grossws avatar hgdharold avatar j0wi avatar japsu avatar jmmk avatar joshuajabbour avatar laurentgoderre avatar mcascallares avatar mikewallisiconsolutions avatar orgads avatar ozlerhakan avatar pkdone avatar sewci0 avatar stefanscherer avatar tianon avatar yosifkit avatar yoz2326 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mongo's Issues

Moped::Errors::ConnectionFailure in

Unable to use / configure mongo and rails
I get error Could not connect to a primary node for replica set #<Moped::Cluster:69855863078300 @seeds=[<Moped::Node resolved_address="127.0.0.1:27017">]>

when open in browser http://0.0.0.0:27017
It looks like you are trying to access MongoDB over HTTP on the native driver port.

Dockerfile

FROM rails:4.2.1
MAINTAINER Sandesh Soni, [email protected]
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
RUN mkdir /gmv
WORKDIR /gmv
ADD Gemfile /gmv/Gemfile
RUN bundle install
ADD . /gmv

docker-compose file

app:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- .:/gmv
ports:
- "3000:3000"
links:
- db
- redis
db:
image: mongo
ports:

  • "27017:27017"

redis:
image: redis
ports:

  • "6379"

error exec numactl: executable file not found in $PATH

Hi, I Have this error in mongo:latest 59b3d123f9b8

 error: exec: "numactl": executable file not found in $PATH

when run:

   docker run  mongo:latest

or

   docker run  mongo:latest mongod

or

 docker run -it --rm mongo:latest bash
 ./entrypoint.sh

or

 docker run -it --rm mongo:latest bash
 ./entrypoint.sh mongod
  • Docker version 1.4.1, build 5bc2ff8

docker info

Containers: 43
Images: 1125
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Dirs: 1219
Execution Driver: native-0.2
Kernel Version: 3.13.0-44-generic
Operating System: Ubuntu 14.04.1 LTS
CPUs: 4
Total Memory: 2.806 GiB
Name: Latitude-E5510

segmentation fault on start on kernel 4.4.1-1-ec2

I'm running Arch 64. Tested on several versions of mongo from this repo and all led to segmentation faults (exit code 139).

On my local machine, I also experienced the same problem on 4.4.1-1, but not 4.4.1-2.

I'll update on whether the problem vanishes on 4.4.1-2-ec2 when it's available.

It's probably a kernel bug but I thought I'll point it out for reference.

Error reading config file: Permission denied

When I try to start a mongo container with a config file specified, it throws an error:

Error reading config file: Permission denied

Setup: I am running as the user 'docker', who has the following file in their home directory:

-rw-rw-r-- 1 docker docker 364 Nov 25 01:12 mongod.conf

I want to make the mongod process start up with the config settings from this file; so my run command is, defined in a shell file, this:

docker run --name insight_mongo1 \
-v /data:/data/db -v /log:/log \
-v /var/run/mongodb:/var/run/mongodb \
-v /home/docker:/made/up/location \
-p 27017:27017 \
-d mongo:3.1 --smallfiles --replSet "repset" \
--config /made/up/location/mongod.conf

I have mapped the location of the config file so the process running in the docker container will be able to access it. But when I run the container, it fails with this error:

2015-11-24T17:13:44.874953724Z Error reading config file: Permission denied
2015-11-24T17:13:44.874998435Z try 'mongod --help' for more information

I have confirmed that the config file should be available in the container, by removing the --config line from the run command โ€“ in this setup, it starts the container successfully, and I can run a bash shell within it and access the file without problems, for example like this:
cat /made/up/location/mongod.conf

Has anybody else managed to get this working at all? If so, is there some crucial difference in the setup?

Appendix: the server is running linux on AWS v2015.03.

Logs

Hi!
Would like to consume the mongo logs but I don't wanna put them in the data folder

I check the entrypoint.sh file and I can see you change the data folder permissions so I understand that the same will be needed to the logs files

Or do you do this in another way?

Thanks!

Detected unclean shutdown - /data/db/mongod.lock is not empty.

c logs db
Attaching to blackbeardapp_db_1
db_1 | 2015-10-21T11:26:35.600+0000 W -        [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
db_1 | 2015-10-21T11:26:35.604+0000 I STORAGE  [initandlisten] **************
db_1 | old lock file: /data/db/mongod.lock.  probably means unclean shutdown,
db_1 | but there are no journal files to recover.
db_1 | this is likely human error or filesystem corruption.
db_1 | please make sure that your journal directory is mounted.
db_1 | found 2 dbs.
db_1 | see: http://dochub.mongodb.org/core/repair for more information
db_1 | *************
db_1 | 2015-10-21T11:26:35.606+0000 I STORAGE  [initandlisten] exception in initAndListen: 12596 old lock file, terminating
db_1 | 2015-10-21T11:26:35.606+0000 I CONTROL  [initandlisten] dbexit:  rc: 100

Here is my docker-compose config, you can see that i don't mount any volumes.

db:
  image: mongo:3.0.7
  ports:
   - "27017:27017"

I guess it is because of a faulted mount with virtualbox, but searched in the issues and found nobody had report this problem.

Does anybody know how to solve this?

Seeding data into a database

What is the best practice regarding seeding data?

I have tried to run mongo myDB myData.js from a linked container, but get the error bash: mongo: command not found. I have also tried to run this same command on my extended mongo image, but get an error mongo isn't running - as expected.

The only thing I can think of is to seed via the application, but this isn't practical. With this approach each time I deploy a new version of the application I would seed the data again - thats not an option for production.

Any help gratefully received.

Volume on Windows: Operation not permitted

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

Afterwards, the following files are present in c:\Users\Dieter\some-folder\DB:

  • mongod.lock
  • WiredTiger
  • WiredTiger.lock
  • WiredTiger.wt
  • journal (empty folder)

I am unable to delete the WiredTiger.wt file even though the docker container has stopped (or has been removed). Restarting the windows VM releases the lock on this file.

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

Resulting files are:

  • mongod.lock
  • journal (folder)
    • j._0
    • tempLatencyTest

Where both files in the journal folder are still locked by the VM.

Running without the docker volume command works.

Can't stop mongo docker container

I am having trouble to stop running mongo docker container. I got following message when I run "docker stop [container name]", Anybody having same issue? the mongodb itself seems to be working fine. just can't stop the container.. so I have to restart VM in order to stop the mongo container.
I am using version 2.6 Dockerfile and build and run with docker-compose.

ERROR: for [container name]  HTTPSConnectionPool(host='X.X.X.X', port=2376): Read timed out. (read timeout=70)
ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).

It seems it is related to http connection error with port 2376, but I couldn't figure out why it is happening, other container built and run by docker-compose works just fine and stopped precisely.

Where are /etc/mongod.conf and the logs in mongo image?

When I pull the mongo image https://github.com/docker-library/mongo/blob/1d641659a75cf2f8ce1b517c7fc2a0ebfd033eed/2.6/Dockerfile I don't find the /etc/mongod.conf file, is it normal?

Here is what I found:

docker run mongo find / -name 'mongo*'
/usr/local/bin/mongoperf
/usr/local/bin/mongorestore
/usr/local/bin/mongotop
/usr/local/bin/mongodump
/usr/local/bin/mongoexport
/usr/local/bin/mongooplog
/usr/local/bin/mongostat
/usr/local/bin/mongos
/usr/local/bin/mongofiles
/usr/local/bin/mongoimport
/usr/local/bin/mongod
/usr/local/bin/mongo

Where is the conf file? Also I don't see the image creating the directory for the mongo logs, how is the log directory set?

too many open files error on start up

I am getting the following error on startup of my docker container:

2015-08-04T17:43:42.693+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=6G,session_max=20000,eviction=(threads_max=4),statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),checkpoint=wait=60,log_size=2GB),statistics_log=(wait=0),
2015-08-04T17:43:54.351+0000 E STORAGE  [initandlisten] WiredTiger (24) [1438710234:351024][1:0x7fe4f3f20b60], file:collection-2071-2488305337711612400.wt, session.open_cursor: /
data/db/collection-2071-2488305337711612400.wt: Too many open files
2015-08-04T17:43:54.351+0000 I -        [initandlisten] Invariant failure: ret resulted in status UnknownError 24: Too many open files at src/mongo/db/storage/wiredtiger/wiredtig
er_session_cache.cpp 78
2015-08-04T17:43:54.375+0000 I CONTROL  [initandlisten]

I have verified that the /etc/iniit.d/mongod file is setting the ulimit -n to 64000, but there appears to be no obvious way to override this via a docker command.

Does anyone have any experience with something similar?

Pass config options to mongo instead of trying to exec them

Might be nice if $1 looks like a config flag to pass it directly to mongo instead of trying to exec $@

#!/bin/bash
set -e

if [ "$1" = 'mongod' ]; then
    chown -R mongodb /data/db  # Maybe this should be in the Dockerfile??
    exec gosu mongodb "$@"
fi

if [[ $1 == --* ]]; then
    chown -R mongodb /data/db
    exec gosu mongodb "$@"
fi

exec "$@"

Or something like that

Set up authentication fails.

It would be nice to have env variables for authentication enabling, to set username/password, storage engine .. etc.
For guideline I have been using https://github.com/tutumcloud/mongodb/tree/master/2.6
Here is my dockerfile:

FROM mongo:2.6

RUN mongo admin --eval "db.createUser({user: 'myuser', pwd: 'mypass', roles:[{role:'dbOwner',db:'admin'}]});"

The build returns:

MongoDB shell version: 2.6.10
connecting to: admin
2015-08-01T00:59:42.877+0000 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2015-08-01T00:59:42.878+0000 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed

Expected result - to build the image and set up new user.

how can I mount host OS directory?

I want to start container and store data to host os directory

root@ubuntu-14:/vagrant/mongo# docker run -P -v /vagrant/mongo/data:/data/db:rw -d mongo

Here is error log

root@ubuntu-14:/vagrant/mongo# docker logs 13601a07c67cafe96c3b96df350e68fd8b086144a06f0bc045b1782ea0cc9924
mongod --help for help and startup options
2014-07-21T12:15:28.268+0000 [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=13601a07c67c
2014-07-21T12:15:28.269+0000 [initandlisten] db version v2.6.1
2014-07-21T12:15:28.269+0000 [initandlisten] git version: e887f95
2014-07-21T12:15:28.269+0000 [initandlisten] OpenSSL version: OpenSSL 1.0.1h-dev xx XXX xxxx
2014-07-21T12:15:28.269+0000 [initandlisten] build info: Linux 3c2933af3ca7 3.8.0-23-generic #34-Ubuntu SMP Wed May 29 20:22:58 UTC 2013 x86_64 BOOST_LIB_VERSION=1_55
2014-07-21T12:15:28.269+0000 [initandlisten] allocator: tcmalloc
2014-07-21T12:15:28.269+0000 [initandlisten] options: {}
2014-07-21T12:15:28.276+0000 [initandlisten] WARNING: This file system is not supported. For further information see:
2014-07-21T12:15:28.277+0000 [initandlisten] http://dochub.mongodb.org/core/unsupported-filesystems
2014-07-21T12:15:28.277+0000 [initandlisten] Please notify MongoDB, Inc. if an unlisted filesystem generated this warning.
2014-07-21T12:15:28.280+0000 [initandlisten] journal dir=/data/db/journal
2014-07-21T12:15:28.282+0000 [initandlisten] recover begin
2014-07-21T12:15:28.282+0000 [initandlisten] info no lsn file in journal/ directory
2014-07-21T12:15:28.283+0000 [initandlisten] recover lsn: 0
2014-07-21T12:15:28.283+0000 [initandlisten] recover /data/db/journal/j._0
2014-07-21T12:15:28.283+0000 [initandlisten] recover info /data/db/journal/j._0 has zero length
2014-07-21T12:15:28.284+0000 [initandlisten] recover cleaning up
2014-07-21T12:15:28.284+0000 [initandlisten] removeJournalFiles
2014-07-21T12:15:28.286+0000 [initandlisten] warning exception removing /data/db/journal/j._0: boost::filesystem::remove: Text file busy: "/data/db/journal/j._0"
2014-07-21T12:15:28.289+0000 [initandlisten] Assertion failure !haveJournalFiles() src/mongo/db/dur_journal.cpp 258
2014-07-21T12:15:28.292+0000 [initandlisten] 0xbff226 0xbb69b8 0xb9c11f 0x7c889b 0x7ce312 0x7cedc7 0x7cf27d 0x7c04db 0x622575 0x62457b 0x5f1085 0x7fc97a26cb45 0x61f977
mongod(_ZN5mongo15printStackTraceERSo+0x26) [0xbff226]
mongod(_ZN5mongo10logContextEPKc+0x188) [0xbb69b8]
mongod(_ZN5mongo12verifyFailedEPKcS1_j+0xef) [0xb9c11f]
mongod(_ZN5mongo3dur18removeJournalFilesEv+0x51b) [0x7c889b]
mongod(_ZN5mongo3dur11RecoveryJob2goERSt6vectorIN5boost10filesystem4pathESaIS5_EE+0x222) [0x7ce312]
mongod(_ZN5mongo3dur8_recoverEv+0x847) [0x7cedc7]
mongod(_ZN5mongo3dur7recoverEv+0x1d) [0x7cf27d]
mongod(_ZN5mongo3dur7startupEv+0x2b) [0x7c04db]
mongod(_ZN5mongo14_initAndListenEi+0x6b5) [0x622575]
mongod(_ZN5mongo13initAndListenEi+0xb) [0x62457b]
mongod(main+0x2b5) [0x5f1085]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7fc97a26cb45]
mongod() [0x61f977]
2014-07-21T12:15:28.293+0000 [initandlisten] dbexception during recovery: 0 assertion src/mongo/db/dur_journal.cpp:258
2014-07-21T12:15:28.293+0000 [initandlisten] exception in initAndListen: 0 assertion src/mongo/db/dur_journal.cpp:258, terminating
2014-07-21T12:15:28.293+0000 [initandlisten] dbexit:
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: going to close listening sockets...
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: going to flush diaglog...
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: going to close sockets...
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: waiting for fs preallocator...
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: lock for final commit...
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: final commit...
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: closing all files...
2014-07-21T12:15:28.293+0000 [initandlisten] closeAllFiles() finished
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: removing fs lock...
2014-07-21T12:15:28.295+0000 [initandlisten] dbexit: really exiting now
root@ubuntu-14:/vagrant/mongo#
root@ubuntu-14:/vagrant/mongo#
root@ubuntu-14:/vagrant/mongo#
root@ubuntu-14:/vagrant/mongo# clear
root@ubuntu-14:/vagrant/mongo# docker logs 13601a07c67cafe96c3b96df350e68fd8b086144a06f0bc045b1782ea0cc9924
mongod --help for help and startup options
2014-07-21T12:15:28.268+0000 [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=13601a07c67c
2014-07-21T12:15:28.269+0000 [initandlisten] db version v2.6.1
2014-07-21T12:15:28.269+0000 [initandlisten] git version: e887f95
2014-07-21T12:15:28.269+0000 [initandlisten] OpenSSL version: OpenSSL 1.0.1h-dev xx XXX xxxx
2014-07-21T12:15:28.269+0000 [initandlisten] build info: Linux 3c2933af3ca7 3.8.0-23-generic #34-Ubuntu SMP Wed May 29 20:22:58 UTC 2013 x86_64 BOOST_LIB_VERSION=1_55
2014-07-21T12:15:28.269+0000 [initandlisten] allocator: tcmalloc
2014-07-21T12:15:28.269+0000 [initandlisten] options: {}
2014-07-21T12:15:28.276+0000 [initandlisten] WARNING: This file system is not supported. For further information see:
2014-07-21T12:15:28.277+0000 [initandlisten] http://dochub.mongodb.org/core/unsupported-filesystems
2014-07-21T12:15:28.277+0000 [initandlisten] Please notify MongoDB, Inc. if an unlisted filesystem generated this warning.
2014-07-21T12:15:28.280+0000 [initandlisten] journal dir=/data/db/journal
2014-07-21T12:15:28.282+0000 [initandlisten] recover begin
2014-07-21T12:15:28.282+0000 [initandlisten] info no lsn file in journal/ directory
2014-07-21T12:15:28.283+0000 [initandlisten] recover lsn: 0
2014-07-21T12:15:28.283+0000 [initandlisten] recover /data/db/journal/j._0
2014-07-21T12:15:28.283+0000 [initandlisten] recover info /data/db/journal/j._0 has zero length
2014-07-21T12:15:28.284+0000 [initandlisten] recover cleaning up
2014-07-21T12:15:28.284+0000 [initandlisten] removeJournalFiles
2014-07-21T12:15:28.286+0000 [initandlisten] warning exception removing /data/db/journal/j._0: boost::filesystem::remove: Text file busy: "/data/db/journal/j._0"
2014-07-21T12:15:28.289+0000 [initandlisten] Assertion failure !haveJournalFiles() src/mongo/db/dur_journal.cpp 258
2014-07-21T12:15:28.292+0000 [initandlisten] 0xbff226 0xbb69b8 0xb9c11f 0x7c889b 0x7ce312 0x7cedc7 0x7cf27d 0x7c04db 0x622575 0x62457b 0x5f1085 0x7fc97a26cb45 0x61f977
mongod(_ZN5mongo15printStackTraceERSo+0x26) [0xbff226]
mongod(_ZN5mongo10logContextEPKc+0x188) [0xbb69b8]
mongod(_ZN5mongo12verifyFailedEPKcS1_j+0xef) [0xb9c11f]
mongod(_ZN5mongo3dur18removeJournalFilesEv+0x51b) [0x7c889b]
mongod(_ZN5mongo3dur11RecoveryJob2goERSt6vectorIN5boost10filesystem4pathESaIS5_EE+0x222) [0x7ce312]
mongod(_ZN5mongo3dur8_recoverEv+0x847) [0x7cedc7]
mongod(_ZN5mongo3dur7recoverEv+0x1d) [0x7cf27d]
mongod(_ZN5mongo3dur7startupEv+0x2b) [0x7c04db]
mongod(_ZN5mongo14_initAndListenEi+0x6b5) [0x622575]
mongod(_ZN5mongo13initAndListenEi+0xb) [0x62457b]
mongod(main+0x2b5) [0x5f1085]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7fc97a26cb45]
mongod() [0x61f977]
2014-07-21T12:15:28.293+0000 [initandlisten] dbexception during recovery: 0 assertion src/mongo/db/dur_journal.cpp:258
2014-07-21T12:15:28.293+0000 [initandlisten] exception in initAndListen: 0 assertion src/mongo/db/dur_journal.cpp:258, terminating
2014-07-21T12:15:28.293+0000 [initandlisten] dbexit:
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: going to close listening sockets...
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: going to flush diaglog...
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: going to close sockets...
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: waiting for fs preallocator...
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: lock for final commit...
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: final commit...
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: closing all files...
2014-07-21T12:15:28.293+0000 [initandlisten] closeAllFiles() finished
2014-07-21T12:15:28.293+0000 [initandlisten] shutdown: removing fs lock...
2014-07-21T12:15:28.295+0000 [initandlisten] dbexit: really exiting now

rs.initiate() not preserved with data volume

Here's how I'm running the container:

  /usr/bin/docker run \
    -d \
    --name=mongo \
    --volumes-from=mongo_data \
    mongo:2.6.7 \
    mongod --smallfiles --replSet "rs0" --noauth

Once it's up, I run "rs.initiate()" against the database. Everything works great. I can docker stop/start all day long and everything is good.

If I "docker rm mongo" and run the command above again, I get the following error in the docker logs for mongo:

[rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)
[rsStart] replSet info you may need to run replSetInitiate -- rs.initiate() in the shell -- if that is not already done
[rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)
[rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)

I'm assuming that rs.initiate() is modifying some file on disk outside of the /data/db tree, but I haven't been able to figure out where that might be yet.

Config Server

I ran into a problem when running this container as a config server, found out the permissions for the configdb directory weren't being set.
docker-entrypoint.sh should chown -R /data/configdb also.

How to get the password if it's not in the logs?

I'm looking at the mongo logs, but I don't see where it set up the password for the database. Anyway I can get it via SSH or anything like that? Will I need to redeploy it and specify a password?

mongod warning while using default settings

when running mongod instance via default container settings docker run mongo -d, server outputs those warnings:

2015-04-17T16:48:45.059+0000 I CONTROL  [initandlisten] 
2015-04-17T16:48:45.059+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-04-17T16:48:45.059+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-04-17T16:48:45.059+0000 I CONTROL  [initandlisten] 
2015-04-17T16:48:45.059+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-04-17T16:48:45.059+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-04-17T16:48:45.059+0000 I CONTROL  [initandlisten]

I think official mongo docker container should not have such warnings in default settings.

Include "transparent_hugepage" configurations to the container

How about setting /sys/kernel/mm/transparent_hugepage/enabled and /sys/kernel/mm/transparent_hugepage/defrag to 'never' on Ubuntu as warned by MongoDB when launching Mongo Shell?

As discussed in the following question on AskUbuntu, it can be done in two ways:

  • By modifying the /etc/sysfs.conf file. This can be done in the Dockerfile, using RUN sed ...
  • By writing values to appropriate files in /sys/kernel/mm/transparent_hugepage/. This can be done in the entrypoint.sh, using echo never > /sys/kernel/mm/transparent_hugepage...

Any dis-benefit to wrapping Mongo within Supervisor?

I am willing to put together a pull request, but I wanted to explore if there is a reason why this might not be a good idea,

I have been wrapping Mongo in supervisor and running my Docker in this way:

FROM ubuntu:14.04
RUN apt-get update -y && apt-get install -y wget
RUN apt-get install -y supervisor
RUN mkdir -p /var/log/supervisor
RUN mkdir -p /data
RUN mkdir -p /logs
RUN cd /opt && wget -nv http://fastdl.mongodb.org/linux/mongodblinux-x86_64-2.6.5.tgz
RUN cd /opt && tar -xvzf mongodb-linux-x86_64-2.6.5.tgz
ADD mongo.conf /opt/mongodb-linux-x86_64-2.6.5/mongo.conf
ADD supervisor.conf /etc/supervisor/conf.d/supervisor.conf
EXPOSE 27017
CMD "/usr/bin/supervisord"

The benefit being that supervisor will restart Mongo if it ever crashed and leave a trail of logs about the process as well.

Any reason why this is a bad idea? I'd be happy to create a pull request and share it with the community.

Also for reference, this is something I have been doing based on https://github.com/InconceivableDuck/Nodevember's presentation, it's been working great for me.

Error starting on non-numa machine

docker run mongo fails on non-numa docker host with numactl: This system does not support NUMA policy and exit status code 1.

I'll fix it ASAP and create PR to fix this issue.

Reported by @henrjk in #11.

Failure on startup if "journal" is symbolic link: error creating directory /data/db/journal: File exists: "/data/db/journal"

Issue: On startup, docker tries to create a journal folder in the data directory. This fails if a symbolic link called journal is already present, and causes the container to error and stop.

Background:

It's recommended to host the journal on a different volume from the data files, for performance reasons. MongoDB doesn't have an option to set the location of the journal, so this is achieved in practice by creating a symbolic link called journal in the data directory, pointing to the different volume, thus:
lrwxrwxrwx 1 mongodb mongodb 18 Jan 14 16:47 journal -> /data/otherjournal

Effect

When I start the mongo docker container, it fails on startup as follows:

2016-01-14T16:48:17.749672599Z 2016-01-14T16:48:17.749+0000 I JOURNAL [initandlisten] journal dir=/data/db/journal
2016-01-14T16:48:17.749964076Z 2016-01-14T16:48:17.749+0000 I JOURNAL [initandlisten] error creating directory /data/db/journal boost::filesystem::create_directory: File exists: "/data/db/journal"
2016-01-14T16:48:17.750154274Z 2016-01-14T16:48:17.749+0000 I STORAGE [initandlisten] exception in initAndListen std::exception: boost::filesystem::create_directory: File exists: "/data/db/journal", terminating
2016-01-14T16:48:17.750255150Z 2016-01-14T16:48:17.750+0000 I CONTROL [initandlisten] now exiting

(full log attached: MongodbDockerLog.txt )

Comments

This does not seem to be a permissions problem; the symbolic link journal is owned by (and therefore completely visible to) the user mongodb with uid 999.

As a workaround for now, we are advising customers to allow the docker container to create the journal in the default location i.e. in a subfolder of the data directory.

mongo:3.0.6 will not work on circleci

mongo:3.0.6 will not run within the Docker environment on CircleCI. For a minimal example, see:

It appears the issue is that gosu attempts to fchown all the open FDs, and for whatever reason on CircleCI this is not possible.

I'm still looking into exactly what FDs these are, but it would seem reasonable to me there might be any number of FDs a process may have open which are not fchownable.

Cannot pull mongo

Hello, i'm need some help. Trying pull mongo, but always get problems with HTTP 400 Error

Pulling mongodb (mongo:3.0)...
Pulling repository docker.io/library/mongo
278372cb22b2: Pulling image (3.0) from docker.io/library/mongo, endpoint: https:278372cb22b2: Error pulling image (3.0) from docker.io/library/mongo, endpoint: 278372cb22b2: Error pulling image (3.0) from docker.io/library/mongo, HTTP code 400e96c112fc: Download complete
430e6598f55b: Error pulling dependent layers

Error pulling image (3.0) from docker.io/library/mongo, HTTP code 400

Tried get other tag (2.6 for example), but got same error. Tried change DNS to 8.8.8.8 or reinstall docker, but it didn' help. Even tried install only docker on clear computer and pull only mongo

Text file busy?

os: windows10

I'm use :
docker run --name mongodb -v /c/Users/workspace/dbbase:/data/db -d mongo:latest

the Error is:

2015-12-25T11:22:57.391+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=4c4dbb727302
2015-12-25T11:22:57.391+0000 I CONTROL [initandlisten] db version v3.2.0
2015-12-25T11:22:57.391+0000 I CONTROL [initandlisten] git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7
2015-12-25T11:22:57.391+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
2015-12-25T11:22:57.391+0000 I CONTROL [initandlisten] allocator: tcmalloc
2015-12-25T11:22:57.391+0000 I CONTROL [initandlisten] modules: none
2015-12-25T11:22:57.391+0000 I CONTROL [initandlisten] build environment:
2015-12-25T11:22:57.391+0000 I CONTROL [initandlisten] distmod: debian71
2015-12-25T11:22:57.391+0000 I CONTROL [initandlisten] distarch: x86_64
2015-12-25T11:22:57.391+0000 I CONTROL [initandlisten] target_arch: x86_64
2015-12-25T11:22:57.391+0000 I CONTROL [initandlisten] options: {}
2015-12-25T11:22:57.400+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2015-12-25T11:22:57.419+0000 E STORAGE [initandlisten] WiredTiger (17) [1451042577:419520][1:0x7fdd36836c80], connection: /data/db/WiredTiger.wt: File exists
2015-12-25T11:22:57.420+0000 E STORAGE [initandlisten] WiredTiger (26) [1451042577:420872][1:0x7fdd36836c80], connection: rename WiredTiger.wt to WiredTiger.wt.1: Text file busy
2015-12-25T11:22:57.422+0000 I - [initandlisten] Assertion: 28595:26: Text file busy
2015-12-25T11:22:57.423+0000 I STORAGE [initandlisten] exception in initAndListen: 28595 26: Text file busy, terminating
2015-12-25T11:22:57.423+0000 I CONTROL [initandlisten] dbexit: rc: 100

Insufficient free space for journal files

I am having the problem mentioned in dockerfile/mongodb#9 and again in docker-library/official-images#281. As suggested in the latter, I opened the issue here.

I am using Mac OS X 10.10.3 with:

> boot2docker version
Boot2Docker-cli version: v1.7.1

> docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): darwin/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64

> docker info | grep Storage                                                                                                                  
Storage Driver: aufs

> docker-compose logs mongo
mongo_1 | mongod --help for help and startup options
mongo_1 | Sat Aug 15 16:19:02.094 [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db/ 64-bit host=dcdc00ea89ac
mongo_1 | Sat Aug 15 16:19:02.094 [initandlisten] db version v2.4.14
mongo_1 | Sat Aug 15 16:19:02.094 [initandlisten] git version: 05bebf9ab15511a71bfbded684bb226014c0a553
mongo_1 | Sat Aug 15 16:19:02.094 [initandlisten] build info: Linux ip-10-154-253-119 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
mongo_1 | Sat Aug 15 16:19:02.094 [initandlisten] allocator: tcmalloc
mongo_1 | Sat Aug 15 16:19:02.094 [initandlisten] options: {}
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] journal dir=/data/db/journal
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] recover : no journal files present, no recovery needed
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten]
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] ERROR: Insufficient free space for journal files
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] Please make at least 3379MB available in /data/db/journal or use --smallfiles
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten]
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
mongo_1 | Sat Aug 15 16:19:02.099 dbexit:
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] shutdown: going to close listening sockets...
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] shutdown: going to flush diaglog...
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] shutdown: going to close sockets...
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] shutdown: waiting for fs preallocator...
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] shutdown: lock for final commit...
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] shutdown: final commit...
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] shutdown: closing all files...
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] closeAllFiles() finished
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] journalCleanup...
mongo_1 | Sat Aug 15 16:19:02.099 [initandlisten] removeJournalFiles
mongo_1 | Sat Aug 15 16:19:02.101 [initandlisten] shutdown: removing fs lock...
mongo_1 | Sat Aug 15 16:19:02.101 dbexit: really exiting now

I am using the mongo:2.4 image and the database has very little data. I started the container successfully many times until it started having this problem.

the container exited immediately after starting

container run command:
ocker run --name my-mongo -d -P mongo:latest --storageEngine wiredTiger
when i ran docker logs my-mongo, the following output appears

error: failed switching to "mongodb": fchown fds permission denied

the host is centos 7 core

In File::open(), ::open for '' failed with errno:2 No such file or directory

HI ALL,
I use docker mongo image, tag 2.6.8, when I into container( with docker exec -it containername bash), and run mongo(with mongo), it have a error as follow.
What file or directory I miss and how to fix it ? Could somebody help? Thanks.

root@1f87c7ec55f4:/data# mongo
MongoDB shell version: 2.6.8
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
        http://docs.mongodb.org/
Questions? Try the support group
        http://groups.google.com/group/mongodb-user
2015-07-02T02:53:48.104+0000 In File::open(), ::open for '' failed with errno:2 No such file or directory
> 

Windows mounting /data/db

Hi,

I'm trying to mount /data/db from my Windows dev PC but everytime I try, Mongo crashes as it seems to not have the right BUT :

  • I have changed the security parameters in windows to allow everyone to do everything (full access)
  • If I mount in a different directory, it works (the container launchs itself and I can write in my directory)

Here are the logs :

2016-01-10T17:35:20.729+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=8036f3a56506
2016-01-10T17:35:20.729+0000 I CONTROL  [initandlisten] db version v3.2.0
2016-01-10T17:35:20.729+0000 I CONTROL  [initandlisten] git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7
2016-01-10T17:35:20.729+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
2016-01-10T17:35:20.729+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2016-01-10T17:35:20.729+0000 I CONTROL  [initandlisten] modules: none
2016-01-10T17:35:20.729+0000 I CONTROL  [initandlisten] build environment:
2016-01-10T17:35:20.729+0000 I CONTROL  [initandlisten]     distmod: debian71
2016-01-10T17:35:20.729+0000 I CONTROL  [initandlisten]     distarch: x86_64
2016-01-10T17:35:20.729+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2016-01-10T17:35:20.729+0000 I CONTROL  [initandlisten] options: { storage: { engine: "wiredTiger" } }
2016-01-10T17:35:20.735+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enab led=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-01-10T17:35:20.741+0000 E STORAGE  [initandlisten] WiredTiger (1) [1452447320:741206][1:0x7f4dc3461c80], connection: /data/db/WiredTiger.wt: Operation not permitted
2016-01-10T17:35:20.742+0000 I -        [initandlisten] Assertion: 28595:1: Operation not permitted
2016-01-10T17:35:20.744+0000 I STORAGE  [initandlisten] exception in initAndListen: 28595 1: Operation not permitted, terminating
2016-01-10T17:35:20.744+0000 I CONTROL  [initandlisten] dbexit:  rc: 100

I have files that have been created in my directory but they seems locked in. I have to turn off the docker-machine to delete WiredTiger.wt

Can't connect, user rights issue? - MongoError: not authorized on myapp to execute command { listIndexes: "sessions", cursor: {} }

So I'm struggling with connecting my mongodb container to my nodeJS one, through docker-compose.

Here's my docker-compose.yml:

db:
  image: mongo
  ports:
    - "27017:27017"
    - "27018:27018"
  command: mongod   --smallfiles --rest --auth --logpath=/dev/null
web:
  build: .
  command: node app.js
  volumes:
    - .:/myapp
  ports:
    - "3000:3000"
  links:
    - db
  environment:
    PORT: 3000

I'm good with this. Then my node app does:

mongoose.connect('mongodb://172.17.0.71:27017/myapp');

which supposedly is the correct URL. But I get the following error:

web_1 | /myapp/node_modules/connect-mongo/node_modules/mongodb/lib/utils.js:98
web_1 |     process.nextTick(function() { throw err; });
web_1 |                                         ^
web_1 | MongoError: not authorized on myapp to execute command { listIndexes: "sessions", cursor: {} }
web_1 |     at Function.MongoError.create (/myapp/node_modules/connect-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/error.js:31:11)
web_1 |     at queryCallback (/myapp/node_modules/connect-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js:282:36)
web_1 |     at Callbacks.emit (/myapp/node_modules/connect-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:95:3)
web_1 |     at null.messageHandler (/myapp/node_modules/connect-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:243:23)
web_1 |     at Socket.<anonymous> (/myapp/node_modules/connect-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:262:22)
web_1 |     at Socket.emit (events.js:107:17)
web_1 |     at readableAddChunk (_stream_readable.js:163:16)
web_1 |     at Socket.Readable.push (_stream_readable.js:126:10)
web_1 |     at TCP.onread (net.js:538:20)

Googling this error doesn't help much, but from my searching it means that I'm not authenticated to access the myapp database.

So the questions are:

  • which user am I authenticated with by default using the mongo docker image?
  • What rights are associated to it?
  • How can I fix my issue?

Does Not Execute on LXC for 3.0.6

We use the mongo:3.0 container for automated testing in CircleCI. The 3.0.6 release has broken this as it fails to run against LXC. We get the following error when attempting to run it:

ubuntu@box207:~/core-wsgi-crm$ docker run mongo:3.0.6 --nojournal
error: failed switching to "mongodb": fchown fds operation not permitted
lxc-start: lxc_start.c: main: 342 The container failed to start.
lxc-start: lxc_start.c: main: 346 Additional information can be obtained by setting the --logfile and --logpriority options.

Running 3.0.5 in the same environment works just fine:

box207:~/core-wsgi-crm$ docker run mongo:3.0.5 --nojournal
2015-10-06T21:38:38.350+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=3e5c553e99ce
2015-10-06T21:38:38.351+0000 I CONTROL  [initandlisten] 
2015-10-06T21:38:38.351+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-10-06T21:38:38.351+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-10-06T21:38:38.351+0000 I CONTROL  [initandlisten] 
2015-10-06T21:38:38.351+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-10-06T21:38:38.351+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-10-06T21:38:38.351+0000 I CONTROL  [initandlisten] 
2015-10-06T21:38:38.351+0000 I CONTROL  [initandlisten] db version v3.0.5
2015-10-06T21:38:38.351+0000 I CONTROL  [initandlisten] git version: 8bc4ae20708dbb493cb09338d9e7be6698e4a3a3
2015-10-06T21:38:38.351+0000 I CONTROL  [initandlisten] build info: Linux ip-10-47-180-245 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 BOOST_LIB_VERSION=1_49
2015-10-06T21:38:38.351+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2015-10-06T21:38:38.351+0000 I CONTROL  [initandlisten] options: { storage: { journal: { enabled: false } } }
2015-10-06T21:38:38.352+0000 I INDEX    [initandlisten] allocating new ns file /data/db/local.ns, filling with zeroes...
2015-10-06T21:38:38.433+0000 I STORAGE  [FileAllocator] allocating new datafile /data/db/local.0, filling with zeroes...
2015-10-06T21:38:38.433+0000 I STORAGE  [FileAllocator] creating directory /data/db/_tmp
2015-10-06T21:38:38.445+0000 I STORAGE  [FileAllocator] done allocating datafile /data/db/local.0, size: 64MB,  took 0.006 secs
2015-10-06T21:38:38.451+0000 I NETWORK  [initandlisten] waiting for connections on port 27017

Nothing stands out at me when looking at the diff between those versions. We've pinned 3.0.5 for our testing for now.

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??

Can not keep the data in the external folder

I have been trying to run the container using:

docker run --name mongo-db -d -p 27017:27017 -v /mnt/lacie/databases/mongo/data:/data mongo

or:

docker run --name mongo-db -d -p 27017:27017 -v /mnt/lacie/databases/mongo/data/db:/data/db mongo.

Next I connect to mongodb, create a db, a collection and insert data on it.

I can stop the container docker stop, run it again docker start and all the data changes will be present in the database.

If I remove container docker rm and create new one - the data dissapear. Why and how can I fix it?

Exit code 100

My container is automatically exiting with error code 100 after sudo docker run -d -p 27017:27017 --name=mongo mongo.

OS stats:

NAME="Amazon Linux AMI"
VERSION="2014.09"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2014.09"
PRETTY_NAME="Amazon Linux AMI 2014.09"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2014.09:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"

3.2: Stacktrace, 3.0 works fine

We're deploying to a Docker host via Puppet. Deployed our app with mongo:3.2 and it was hanging - looks like mongo was stacktracing (see below).

Replaced with a 3.0 instance under exact same conditions and we're apparently happy again.

Stacktrace

The data folder in both cases is bind-mounted. On the host it is managed by puppet thus:

file { '/mnt/reporting-server/mongo' :
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
require => File['/mnt/reporting-server'],
before => Class['docker::run_instance'],
}

OS X issue

Hi all,

I try to run mongo with docker on my mac :

docker run --name mongo -p 27017:27017 -v ~/docker_data/mongodb:/data/db -d mongo --storageEngine wiredTiger

But I have this error on my log :

2015-11-28T15:05:05.734+0000 E STORAGE  [initandlisten] WiredTiger (1) [1448723105:733979][1:0x7f57d29c2b60], connection: /data/db/WiredTiger.wt: Operation not permitted
2015-11-28T15:05:05.735+0000 I -        [initandlisten] Assertion: 28595:1: Operation not permitted
2015-11-28T15:05:05.745+0000 I STORAGE  [initandlisten] exception in initAndListen: 28595 1: Operation not permitted, terminating
2015-11-28T15:05:05.745+0000 I CONTROL  [initandlisten] dbexit:  rc: 100
2015-11-28T15:06:54.053+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-11-28T15:06:54.053+0000 I CONTROL  [initandlisten] dbexit:  rc: 100
2015-11-28T15:12:07.653+0000 I STORAGE  [initandlisten] exception in initAndListen std::exception: boost::filesystem::status: Permission denied: "/data/db/storage.bson", terminating
2015-11-28T15:12:07.654+0000 I CONTROL  [initandlisten] dbexit:  rc: 100
chown: cannot access `/data/db/journal': Protocol error
chown: changing ownership of `/data/db/mongod.lock': Protocol error
chown: changing ownership of `/data/db/WiredTiger': Protocol error
chown: changing ownership of `/data/db/WiredTiger.lock': Protocol error
chown: changing ownership of `/data/db/WiredTiger.wt': Protocol error
2015-11-28T15:13:39.141+0000 I STORAGE  [initandlisten] exception in initAndListen std::exception: boost::filesystem::status: Permission denied: "/data/db/storage.bson", terminating
2015-11-28T15:13:39.141+0000 I CONTROL  [initandlisten] dbexit:  rc: 100

How can I run it and save content on my folder. ?

User and group ID mappings

Are you open to a PR that enables user and group ID mappings? Considering that docker has no built-in solution for this (moby/moby#7198), the files in the shared volume end up as owned by the container mongodb user.
A simple script in the entrypoint that modifies the mongodb user and group ID (based on two environment variables) would solve this issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.