Skip to content

Instantly share code, notes, and snippets.

@matheusfaustino
Last active November 23, 2016 11:08
Show Gist options
  • Save matheusfaustino/ff2a4121a83e97dd000a42692afe8992 to your computer and use it in GitHub Desktop.
Save matheusfaustino/ff2a4121a83e97dd000a42692afe8992 to your computer and use it in GitHub Desktop.
Start mongoshell from a makefile. I recommend it for simple tasks, like a exercise in class.
shell:
@docker start mongoserver
@docker start mongoshell -i
@docker stop mongoshell mongoserver
connect: createMongo
docker run -it --name mongoshell --link mongoserver:mongo mongo sh -c 'exec mongo "$$MONGO_PORT_27017_TCP_ADDR:$$MONGO_PORT_27017_TCP_PORT"'
@docker stop mongoshell mongoserver
createMongo:
@docker run --name mongoserver -p 27017:27017 -p 28017:28017 -d mongo
cleanMongo:
@docker rm mongoshell mongoserver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment