I have a running mongodb on docker. I created user on it but I couldn't login with user credentials from docker-compose.
Here is my configurations:
Create user:
use database
db.createUser({user: "username", pwd: "password", roles: [{role: "readWrite", db: "database"}]});
docker-compose.yml
mongo:
container_name: container
image: mongo:latest
env_file: .env
entrypoint:
MONGO_INITDB_ROOT_USERNAME: ${MONGODB_AUTH_USER}
MONGO_INITDB_ROOT_PASSWORD: ${MONGODB_AUTH_PASS}
But I am getting below error when trying to run docker-compose up command:
ERROR: for 177f1a769910_smartcap-mongodb Cannot start service mongo: OCI runtime create failed: container_linux.go:346: starting container process caused "exec: \"MONGO_INITDB_ROOT_USERNAME:username\": executable file not found in $PATH": unknown
How can I solve this problem? Could you help me?