Criando container docker com mongo

13 de maio de 2020   |   by administrador
docker pull mongo

docker run --name mymongo -d -p 27017:27017 mongo --noauth --bind_ip=0.0.0.0

use MongoDBCompass para acessar

acesse o container com docker exec -it mymongo bash

mongo

db.createUser(
{
user: "sa",
pwd: "strongpassword",
roles: [ { role: "userAdminAnyDatabase", db: "admin" },
{ role: "readWriteAnyDatabase", db: "admin" },
{ role: "dbAdminAnyDatabase", db: "admin" },
{ role: "clusterAdmin", db: "admin" },
{ role: "dbOwner", db:"admin"}]
}
)