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: https://meanjs.org/. 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.

  • Difference between links and depends_on in docker_compose.yml
  • X11 forward to windows x server for docker client in AWS
  • Can’t link to MS Azure account
  • What is Docker URL
  • 'Too many levels of symbolic links' in /usr/local/bin after performing docker pull
  • Is it possible to use Gitlab and WordPress container linked to only one Mariadb container?
  • 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 bridge and Falcon gunicorn
  • What is the proper endpoint for connecting to azure container service swarm cluster from c# https://github.com/Microsoft/Docker.DotNet
  • Php application started working slowly with docker
  • Recovering volumes lost after docker-compose up
  • How to access ports in docker custom bridge networks
  • How to connect to a docker container from outside the host (same network) [Windows]
  • 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: https://gist.github.com/katychuang/10439243:

    # 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.

    Sidenote:

    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:

    <string>/usr/local/opt/mongodb/bin/mongod</string>
    <string>--config</string>
    <string>/usr/local/etc/mongod.conf</string>
    

    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.