Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Željko Šević
Željko Šević

Posted on • Originally published atsevic.dev on

     

MongoDB containers with Docker Compose

Docker Compose facilitates spinning up a container for the MongoDB database without installing MongoDB locally.

Prerequisites

  • Docker Compose installed

Configuration

The following configuration spins up the MongoDB container with the UI tool (Mongo Express).

The connection string for the MongoDB database ismongodb://localhost:27018.

Mongo Express is available at thehttp://localhost:8082 link. Use the below Basic auth credentials to log in to Mongo Express.

# docker-compose.ymlversion:'3.8'services:mongo:image:'mongo:7.0.5'ports:-27018:27017volumes:-my-data:/var/lib/mongodb/datamongo-express:image:'mongo-express:1.0.2'ports:-8082:8081environment:ME_CONFIG_BASICAUTH_USERNAME:usernameME_CONFIG_BASICAUTH_PASSWORD:passwordvolumes:my-data:
Enter fullscreen modeExit fullscreen mode

Run the following command to spin up the containers.

docker-compose up
Enter fullscreen modeExit fullscreen mode

Course

Build your SaaS in 2 weeks -Start Now

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Node.js developer, creating tech content at https://sevic.dev
  • Location
    Belgrade, Serbia
  • Joined

More fromŽeljko Šević

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp