MongoDB
1. Installing mongoDB
- Run a mongoDB server using docker
Go to the Official Image of mongo:
https://hub.docker.com/_/mongo
In the "How to use this image" section, you'll see the following command:
docker run --name mongo -d -p 27017:27017 mongo:6
Or with a password:
docker run --name mongo -d -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=secret mongo
And, if you wanna add extra security, use a certificate:
docker run --name mongo -d \
-p 27017:27017 \
-e MONGO_INITDB_ROOT_USERNAME=mongoadmin \
-e MONGO_INITDB_ROOT_PASSWORD=secret \
-v ~/Desktop/certificates:/certs:ro \
mongo \
--tlsMode requireTLS \
--tlsCertificateKeyFile /certs/server.pem \
--tlsCAFile /certs/rootCA.crt