-
Notifications
You must be signed in to change notification settings - Fork 3
Description
According to mongodb's docker dockers:
As noted above, authentication in MongoDB is fairly complex (although disabled by default). For details about how MongoDB handles authentication, please see the relevant upstream documentation:
https://docs.mongodb.com/manual/tutorial/enable-authentication/
You can set the username and password in the docker-compose.yml
:
# Use root/example as user/password credentials
version: '3.1'
services:
mongo:
image: mongo
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: sfasdasd34324
You will also need to ensure that on start up the correct auth issues are set (this can be complex and @msporny might be the person to figure out what is being set).
We will then to load the docker-compose.yml
file with a project which has the following set in it's mongo settings:
config.mongodb.username = 'root';
config.mongodb.password = 'sfasdasd34324';
you also might need to set an authMechanism
, but it looks like MongoDb is smart enough to figure that out on it's own.
This needs to be tested with the newer mongo 3.5 driver to ensure that I got the auth login changes correct. This is working in development.