Created
May 21, 2014 11:44
-
-
Save johnykov/bfc7825d54a5294d394e to your computer and use it in GitHub Desktop.
Step-by-step mongo in docker on macosx
This file contains 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
1. | |
brew install boot2docker | |
brew install docker | |
echo "export DOCKER_HOST=tcp://127.0.0.1:4243" >>~/.bash_profile | |
2. | |
boot2docker init #once init virtualbox vm | |
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port$27017,tcp,,27017,,27017"; | |
3. | |
boot2docker up | |
docker pull dockerfile/mongodb #pulling image once | |
4. | |
docker run -d -p 27017:27017 --name mongodb dockerfile/mongodb #set name once | |
# do magic here, use client mongo shell on your host i.e. | |
mongo | |
use jan | |
db.foo.save({"wat":"a start"}) | |
5. | |
docker stop mongodb | |
boot2docker stop | |
6. | |
boot2docker start | |
docker start mongodb | |
# do magic here, use client mongo shell on your host i.e. | |
mongo | |
use jan | |
db.foo.find() | |
# assert obj in collection | |
7. | |
docker stop mongodb | |
boot2docker stop | |
#useful commands: | |
# docker ps -a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment