To start the container, I am typing the following command:
sudo docker run -i -t -p 28000:27017 mongo:latest /usr/bin/mongod --smallfiles
But I want to open the shell in this container to type the mongo commands. What command should I run to do the same?
This is an alternate way: Open a new terminal
Your mongo shell starts in this terminal now.
The thing that I struggled too but found a solution:
Now you have created a running Docker container with everything you need. Now if you want to connect from any client with an admin user, just run this
You can run the interactive mongo shell by running the following command:
Otherwise, if your container is already running, you can use the
exec
command: