Files
compose-anything/src/mongodb-standalone

MongoDB Standalone

English | 中文

MongoDB is a document database designed for ease of application development and scaling.

Initialization

  1. Copy the example environment file:

    cp .env.example .env
    
  2. Start the service:

    docker compose up -d
    
  3. Connect to MongoDB at mongodb://root:password@localhost:27017/admin

Services

  • mongo: The MongoDB service.

Configuration

  • Username: root
  • Password: password
  • Database: admin
  • Port: 27017
Variable Description Default
MONGO_VERSION MongoDB version 8.0.13
MONGO_INITDB_ROOT_USERNAME Root username root
MONGO_INITDB_ROOT_PASSWORD Root password password
MONGO_INITDB_DATABASE Initial database admin
MONGO_PORT_OVERRIDE Port override 27017

Volumes

  • mongo_data: A volume for storing MongoDB data.
# Using mongo shell
mongo mongodb://root:password@localhost:27017/admin

# Using mongosh
mongosh "mongodb://root:password@localhost:27017/admin"

Security Notes

  • Change the default password before production use
  • Consider using MongoDB authentication and authorization features
  • Restrict network access as needed

License

MongoDB is available under the Server Side Public License (SSPL).