I'm setting up my first docker containers with mongo and mongo-express using the official docker-compose instructions e.g. something like this:
# 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: example
mongo-express:
image: mongo-express
restart: always
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: example
ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/
I can access mongo-express through my browser but there is no login screen it just loads all of the tables immediately - no authentication. Is there a way to configure mongo-express authentication to load a login screen to accept env vars in the docker-compose yml file and prevent immediate access to the tables?
The mongo docker container provides env vars to control access to admin panel via basic auth only. Other recommendations are to add your own via passport etc, so wouldnt use basic auth in production, but this works fine for testing small dbs.