Skip to content

Instantly share code, notes, and snippets.

@HoverBaum
Created April 9, 2018 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HoverBaum/290105b2747754b39ae0ba6f0cf5955d to your computer and use it in GitHub Desktop.
Save HoverBaum/290105b2747754b39ae0ba6f0cf5955d to your computer and use it in GitHub Desktop.
Mongo using Docker.

Mongo using Docker

This gist detailes scripts you can use to run a Mongo instance for your development using docker.

The provided scripts help you to create, run, stop and interact with a local mongo Database. You should keep in mind that all data is stored inside the Docker container and will be lost when you destroy it.

#!/usr/bin/env bash
docker pull mongo
docker create --name my-mongo -p 27017:27017 mongo
#!/usr/bin/env bash
docker start my-mongo
#!/usr/bin/env bash
docker stop my-mongo
#!/usr/bin/env bash
docker run -it --link my-mongo:mongo --rm mongo sh -c 'exec mongo "$MONGO_PORT_27017_TCP_ADDR:$MONGO_PORT_27017_TCP_PORT/test"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment