Installed docker and ran a container with mongodb, now brew's mongodb isn't working

I recently installed docker and ran a container with mongodb, now my local brew’s mongodb isn’t working.

I am using a mac and originally installed mongodb using homebrew. brew services list now shows the mongodb service as ‘running’ but in yellow (apparently this means unknown), and I cannot connect using mongochef. This began happening after only once stopping the service brew service stop mongodb, as it was preventing me from using docker with this project: I stopped the service because there was a conflict for the mongodb port. Now even after destroying all the docker containers, I can’t get mongodb working on my machine. I have tried reinstalling mongodb using brew, and stopping and starting the service.

  • Fig Python 3 Compatible?
  • How do I run Apache 2 on Alpine in Docker?
  • Best approach of using gpg key generation for docker images
  • Install Docker on Jenkins on OSX
  • How to enable_ipv6 with docker compose version 3
  • Using docker-compose to start web and backend. How can I get the IP of backend from web?
  • I have also tried deleting the file in /tmp as here:
    MongoDB Failing to Start – ***aborting after fassert() failure

    Any suggestions about where to look and what to do?

  • Dockerfile build error when use apt-get install gcc
  • docker out of disk space
  • how to set /sys/kernel/mm/transparent_hugepage/enabled to 'never' on coreos
  • How to configure spring interceptor to get called with every request
  • Docker Tomcat users configuration not working
  • dial tcp: lookup no such host
  • One Solution collect form web for “Installed docker and ran a container with mongodb, now brew's mongodb isn't working”

    So this turned out to be one of those really annoying problems that comes up when you have a lot of other stuff to do. I am still not completely sure if it was one issue or multiple issues. If I was to try and fix it again though, this is the order I would go in:

    I removed mongo completely and reinstalled (this finally fixed the mongodb service’s status from being shown in yellow instead of in green), as here:

    # checks to see if running 
    launchctl list | grep mongo
    launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
    launchctl remove homebrew.mxcl.mongodb
    pkill -f mongod
    rm -f ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
    brew uninstall mongodb
    # double check existence
    ls -al /usr/local/bin/mong*
    ls -al ~/Library/LaunchAgents
    # this was mentioned in the comments
    rm -R /usr/local/var/mongodb

    However, I think my data was corrupted too. Unfortunately mongod --repair (mongodb error: how do I make sure that your journal directory is mounted) was saying it couldn’t repair the data without running with --journaled but that didn’t work either. So I deleted my databases in /data/db I didn’t need them anyway because I have backups and just restored them easily.

    Hope that can help anyone having similar issues.


    The mongod command on the command line gave some helpful output in tracking this down.
    Also vim ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist allowed me to see which command was being run:


    This showed me that /usr/local/etc/mongod.conf was being used, and realising that whilst running /usr/local/opt/mongodb/bin/mongod was working, running:
    /usr/local/opt/mongodb/bin/mongod --config /usr/local/etc/mongod.conf was not working, helped me narrow the problem down

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.