DEV Community


Posted on

Running MongoDB on Docker Compose

Running MongoDB on Docker Compose
by Versha
Table of Contents

In this article, we will discuss how DBA can run a MongoDB instance using docker-compose. It’s very easy and quite flexible to handle. According to my opinion docker-compose removes all the installation and configuration pain when you need a test instance immediately. In a non-production environment for proof of concepts (POC) environment, you can easily use MongoDB on docker-compose.

High-Level Steps for Installation & Configuration

Install Docker
Install Docker compose
Take the docker-compose code with MongoDB
Run the docker-compose
Connect to MongoDB Database
Connect From MongoDB from Docker bash

mkdir -p /opt/docker_com_repo

cd /opt/docker_com_repo

vi docker-compose.yml

Copy Below docker compose code for MongoDB and paste in side the docker-compose.yml

read more :

Discussion (0)