namessite.blogg.se

Mongodb compass docker image
Mongodb compass docker image





  1. #Mongodb compass docker image software#
  2. #Mongodb compass docker image code#

Services: mongo: #Container name of mongodb container_name: stackcoder-mongo #Docker image from image: mongo environment: #Default username, password and database of mongodb MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: root MONGO_INITDB_DATABASE: stackcoder ports: - 27017 :27017 volumes: #Adding volume makes sure that data is persistant and wont get deleted after your docker stops #Everytime this mongodb service starts data from your system mongo-data gets replicated to /data/db folder inside docker container - mongo-data:/data/db networks: #Adding network makes sure that we can operate with our API's like local setup - stackcoder api: #Container name of your API container_name: stackcoder-api #Since we are building image on our own we point to the Dockerfile path build: #Context tell the path to look for Dockerfile context.

#Mongodb compass docker image code#

#Copy rest of the code to container COPY. NOTE: I have added comments in the Dockerfile and docker-compose.yml to make sure you understand each and every lineĭockerfile FROM node:18.12-slim WORKDIR /usr/app COPY. The following is the project structure of my ExpressJs application.ĭocker-compose.yml is used run multiple services and manage them with ease.ĭockerfile is used to create our custom docker image. Later we will see how we can access MongoDB from MongoDB Compass. In this article, let me walk you through how we can set up Docker to run NodeJs, and MongoDB like a breeze. In my latest project, I got a chance to work extensively on Docker.

mongodb compass docker image mongodb compass docker image

You might have configured your operating system-specific settings the same has to be shared with your colleagues, this will be an overhead in itself to manage all these settings and dependencies of your project.

#Mongodb compass docker image software#

MongoDB database connection with MongoDB CompassĪs you know with Docker's help, we can run our project on multiple devices without project software dependencies and developers bragging that it's working on your laptop but not mine.įor example, if I want to run ExpressJs (NodeJs) with the MongoDB application then I have to go ahead and download NodeJs as per my operating system and I have to download MongoDB and set it up according to the operating system.Docker & docker-compose.yml file to run your NodeJs & MongoDB applications.







Mongodb compass docker image