Created
July 1, 2020 20:08
-
-
Save byk0t/5326de4fe66384e999a9079198105996 to your computer and use it in GitHub Desktop.
How to connect to mongodb in docker container from localhost
This file contains hidden or 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
# sample command from dockerhub | |
docker run --name some-mongo -d mongo:tag | |
# but to make mongo available from localhost you should change this command a bit | |
docker run --name some-mongo -p 27017:27017 -d mongo:tag | |
# so now you can connect to the mongo using the next command | |
mongo -host localhost -port 27017 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment