We can run the interactive shell by running the following command:
docker container exec -it MyContainerName bash
Note: From this command, you will be able to get a bash shell running into the cointainer.
Then, we must get the mongo shell as admin. Otherwise, you will not be able to see the databases and collections.
Run mongo -u "USERNAME" -p "PASSWORD" HOSTIP --authenticationDatabase "admin"
That's it. Now, you are able to run any command such as show dbs
.
References:
https://stackoverflow.com/questions/32944729/how-to-start-a-mongodb-shell-in-docker-container