Reference : 使用 Docker Compose 建立有 Auth 的 MongoDB Replica Set
- Way 1
pass username and password when run docker-compose up command
username=root password=pass.123 docker-compose up -d
- Wasy 2
You need to change
username
andpassword
in thestart.sh
first, then runt it. It will stop useless container.
sh ./start.sh