Skip to content

docker mongodb cluster, not creating given user in database #703

@smikayel

Description

@smikayel

here is the docker file, after creating the docekr containe with command docker compose up
it's successfully runging the container, but I'm not able to connect with admin and pass to the mentioned database
in docker log I found that there we are missing user

version: '3.8'

services:
  mongo:
    image: mongo
    hostname: mongodb-server
    ports:
      - "27017:27017"
    restart: always
    environment:
      MONGO_INITDB_DATABASE: mydatabase
      MONGO_INITDB_ROOT_USERNAME: admin
      MONGO_INITDB_ROOT_PASSWORD: password
    volumes:
      - ./data/mongo/001_users.js:/docker-entrypoint-initdb.d/001_users.js:ro
      - mongodb:/data/db
      - mongodb_config:/data/configdb

volumes:
  mongodb:
  mongodb_config:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions