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.

  • Docker Ip Failover
  • Docker swarm: guarantee high availability after restart
  • MySQL container crash after /etc/mysql/my.cnf change, how to edit back?
  • Is docker swarm manager part of the swarm cluster?
  • Docker Error: CSS File in Mapped Volume Fails to Update
  • Multi Docker Elastic Beanstalk: upload .ebextensions
  • 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?

  • Docker Mysql (Hibernate) Connection
  • Trying to build openface docker container
  • Run multi mysql services on same machine
  • How to get IP address of running docker container
  • kapacitor: setting slack webhook URL in .tick file
  • OSX Docker/WordPress/MySQL — Connection Error: (1130) Host '' is not allowed to connect to this MariaDB server
  • 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.