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/"
ah, this is resolved via the --smallfiles option
Sadly it didn't help me. Any other options guys ? I run it via
docker run -p 127.0.0.1:27017:27017 --name mymongo -d mongo:3.1.6 --smallfiles
Doesn't work for me either. Trying to run mongodb docker container in Windows 10. I'm using:
docker run --name mongodb_svcrm -p 27017:27017 -v C:\Users\matt.moran\Documents\myproject\data\db:/data/db -d mongo --smallfiles
docker ps -a shows it exits with code 100. There's plenty of disk space in the host system for journals.
Any idea why this is happening?
@MattMoranJava for Docker on Windows, see https://github.com/docker-library/mongo/issues/107#issuecomment-245690331
try to make the whole data directory as a volume
instead of
volumes:
- ./data/db:/data/db
try
volumes:
- ./data:/data
it works for me.
Since the Dockerfile defines a volume on /data/db, if you only mount /data you will _not_ be keeping your data. If you check our data folder on your host, you'll see that it has a db subdirectory, but it should be empty, because it's in a separate volume.
@tianon you are right this doesn't solve the problem.
So are there any solutions to this? Should directory mounting work with mongo:windowsservercore image?
@aorlenko, current solutions are to mount a folder from the VM (https://github.com/docker-library/mongo/issues/74#issuecomment-172675750) or use a named volume (https://github.com/docker-library/mongo/issues/74#issuecomment-238918488).
Yes, the windowsservercore images work just fine if you are using windows containers:
PS C:\Users\Docker\docker> docker run -d --name mongo -v C:\Users\Docker\docker\mongo-data:C:\data\db mongo:3.4-windowsservercore
PS C:\Users\Docker\docker> ls .\mongo-data\
Directory: C:\Users\Docker\docker\mongo-data
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 9/13/2017 2:30 PM diagnostic.data
d----- 9/13/2017 2:30 PM journal
-a---- 9/13/2017 2:30 PM 16384 collection-0--6462546833303440715.wt
-a---- 9/13/2017 2:30 PM 16384 collection-2--6462546833303440715.wt
-a---- 9/13/2017 2:30 PM 16384 index-1--6462546833303440715.wt
-a---- 9/13/2017 2:30 PM 16384 index-3--6462546833303440715.wt
-a---- 9/13/2017 2:30 PM 16384 index-4--6462546833303440715.wt
-a---- 9/13/2017 2:30 PM 0 mongod.lock
-a---- 9/13/2017 2:30 PM 16384 sizeStorer.wt
-a---- 9/13/2017 2:30 PM 95 storage.bson
-a---- 9/13/2017 2:30 PM 49 WiredTiger
-a---- 9/13/2017 2:30 PM 21 WiredTiger.lock
-a---- 9/13/2017 2:30 PM 986 WiredTiger.turtle
-a---- 9/13/2017 2:30 PM 24576 WiredTiger.wt
-a---- 9/13/2017 2:30 PM 4096 WiredTigerLAS.wt
-a---- 9/13/2017 2:30 PM 16384 _mdb_catalog.wt
PS C:\Users\Docker\docker>
Most helpful comment
try to make the whole data directory as a volume
instead of
volumes:
- ./data/db:/data/db
try
volumes:
- ./data:/data
it works for me.