Last active
June 28, 2019 00:10
-
-
Save alexandreramosdev/e7589c7ca823a63f144f9d6af71d1158 to your computer and use it in GitHub Desktop.
Docker script mongodb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run \ | |
--name mongodb \ | |
-p 27017:27017 \ | |
-e MONGO_INITDB_ROOT_USERNAME=admin \ | |
-e MONGO_INITDB_ROOT_PASSWORD=senhaadmin \ | |
-d \ | |
mongo:4 | |
docker run \ | |
--name mongoclient \ | |
-p 3000:3000 \ | |
--link mongodb:mongodb \ | |
-d \ | |
mongoclient/mongoclient | |
docker exec -it mongodb \ | |
mongo --host localhost -u admin -p senhaadmin --authenticationDatabase admin \ | |
--eval "db.getSiblingDB('herois').createUser({user: 'alexandreramos', pwd: 'minhasenhasecreta', roles: [{role: 'readWrite', db: 'herois'}]})" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment