juancsr
juancsr

Reputation: 329

disable default authentication in mongo docker

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 

Upvotes: 18

Views: 16840

Answers (1)

pacuna
pacuna

Reputation: 2099

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

Upvotes: 42

Related Questions