Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJosman Perez
10,117 PointsAccess shell of mongotest
How to access shell of mongo after running mongotest container
2 Answers
Josman Perez
10,117 PointsIf you want to access the shell of a container after running the:
docker run -p 27017:27017 -p 28017:28017 mongotest
You have to expose the shell in the container, if you are running docker >= 1.3
You need you to type in your host OS:
docker exec -it [IDofContainerOrName] bash
`
And the you'll be prompted with the mongo db shell of the container :)
Andy Chung
229 PointsThis is awesome, Thanks bro
Nikhilesh Katakam
1,175 PointsIf you want to get the container id to use in the above command posted by Josman Perez use:
docker container ls
Mat T'Qartit
29,277 PointsOr even simpler: docker ps
Josman Perez
10,117 PointsJosman Perez
10,117 PointsI want to answer my own question just in case you might be facing the same doubt