disable default authentication in mongo docker

Viewed 7725

I want to disable the default auth (avoid to use mongo --authenticationDatabase "auth_db").

in mongo using docker-compose, here is my docker-compose file:

version: "2"

services:
    mongodb:
    image: mongo:latest
    environment: 
      - MONGO_DATA_DIR=/data/db
      - MONGO_LOG_DIR=/dev/null
      - MONGO_INITDB_ROOT_USERNAME=some_user
      - MONGO_INITDB_ROOT_PASSWORD=some_password
    volumes:
      - ./mongo_data:/data/db
    ports:
      - 27017:27017 
1 Answers

Just don't pass the MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD env vars when creating the container.

Related