Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

mongo:latest crashes on restart #746

Closed
vicary opened this issue Jul 1, 2015 · 12 comments
Closed

mongo:latest crashes on restart #746

vicary opened this issue Jul 1, 2015 · 12 comments

Comments

@vicary
Copy link

vicary commented Jul 1, 2015

It runs well on the first download, but when I stop it never start again.

Here is the last lines of stdout.

2015-07-01T12:50:15.888+0000 W -        [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
2015-07-01T12:50:15.897+0000 I STORAGE  [initandlisten] ************** 
old lock file: /data/db/mongod.lock.  probably means unclean shutdown,
but there are no journal files to recover.
this is likely human error or filesystem corruption.
please make sure that your journal directory is mounted.
found 1 dbs.
see: http://dochub.mongodb.org/core/repair for more information
*************
2015-07-01T12:50:15.904+0000 I STORAGE  [initandlisten] exception in initAndListen: 12596 old lock file, terminating
2015-07-01T12:50:15.904+0000 I CONTROL  [initandlisten] dbexit:  rc: 100

Sorry I'm quite new to docker, while you guys are fixing this, can I like ssh in and delete the lock file myself? How can I do so?

@TeckniX
Copy link
Contributor

TeckniX commented Jul 1, 2015

@vicary you can do the following to attach to the container and do some clean-up:
$ docker-machine ssh dev
(will log you in to the actually VM)

docker@dev:~$ docker start -ai <container-id>

simply replace the container-id above with your monogodb container id obtained via docker ps -a
That should provide you with shell access to clean-up the data and then start the container.

@jmorganca
Copy link
Contributor

Thanks for the issue, are volumes enabled?

@jmorganca jmorganca added the bug label Jul 1, 2015
@vicary
Copy link
Author

vicary commented Jul 3, 2015

@TeckniX Thanks!

@JeffDM Volumes are not mapped to Mac folders. Interestingly enough, it restarts normally in another Mac. Not sure but I will try again and update here.

@vicary
Copy link
Author

vicary commented Jul 3, 2015

Funny enough, I've got the steps to fix this:

  1. Mount the /data/db volume to Mac
  2. Remove it from setting
  3. Docker will start by kitematic automatically
  4. Mounted folder is empty so it can be started
  5. docker exec mongo rm /data/db/mongod.lock

Then it can be restarted normally.

Since this is a Macbook Air I suspect it is related to the Mac sleep affecting VM state and ultimately killing the mongod process without proper shutdown.

@virgafox
Copy link

I'm experiencing the same issue. I use mongodb inside a container to keep my machine clean during development. If I start and stop it using CLI no problem, using Kitematic if I use the stop button I can't restart the container anymore with that error. I'm using Docker toolbox 1.8.1b. No shared volumes enabled, only binded port 27017.

@FrenchBen
Copy link
Contributor

@virgafox Kitematic shouldn't do anything different than the CLI.
Did you create the container via the command line? If so, can you share the command arguments you used to create the container?

@virgafox
Copy link

@FrenchBen The container is always created via CLI, I couldn't find a way to bind ports creating via kitematic. The command is docker run --name mongodb -p 27017:27017 -d mongo. If I stop the container via the stop button in kitematic, I can't restart it anymore in any way, having the same error explained in this issue. If I stop it with docker stop mongodb I can restart it via cli with no problems.

@FrenchBen
Copy link
Contributor

@virgafox Thanks for the break down of the issue, which I was able to replicate. I found the source of the #bug and will be pushing a create a patch/PR soon to get this fixed!

@virgafox
Copy link

@FrenchBen Thanks man. Maybe this is a little OT, but If I installed all via docker toolbox, how do I upgrade when the update is out? thanks again

@FrenchBen
Copy link
Contributor

I believe you'll be able to download the latest toolbox and run the installer from it.

@virgafox
Copy link

@FrenchBen nice

@mchiang0610
Copy link
Contributor

Seems like an issue with Official images. The team is notified.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants