Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 637 Bytes

mongoconfig.md

File metadata and controls

31 lines (23 loc) · 637 Bytes

Deploy mongodb in as a Docker container

First you need to install Docker in the host, then use the following steps:

Get the image

docker pull mongo

Run the container

docker run -d -p 27017-27019:27017-27019 -v <path/db/local/host>:/data/db --name mongodb -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=strong_password  mongo

Enter to the container

docker exec -it mongodb bash

Conect with the admin user

mongo -u admin -p <previous password>

Exit the mongo shell and the container

exit
exit