Docker: Your First MongoDB Connection in 10 mins


This is the command to run

Then check the process with docker ps

Docker Compose

When use compose we put the long command to docker-compose.yml file.

If you don’t need password just leave the environment: block

Then run the docker-compose up

MongoDB Connection

From Docker

From CLI: mongo

Step 1: Installation

The shell login needs mongo command line which is in the mongo-org packages.

Fedora/Red Hat:


Step 2: Test port open

Then you can test the connection with

The output should show success port is opened.

Step 3: Connecting

Then you can connect with the command

Test with some command:

Hope this helps




Co-founder and Coder at work !

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store