Last active
September 1, 2020 18:49
-
-
Save mrsarm/8cf9bf757a5c4520fdae0cb35509cd03 to your computer and use it in GitHub Desktop.
docker-compose.yml mongo-latest: launch a MongoDB server with a volume attached to persist data across sessions
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
mongo-latest: | |
image: mongo | |
ports: | |
- "27017:27017" | |
volumes: | |
- mongo-data-latest:/data/db | |
# - `docker-compose up' to start MongoDB attached to the console, or `.. start' detached | |
# - Connect with `docker-compose run mongo-latest mongo HOSTIP/DBNAME' | |
# - `docker-compose stop' to stop the service if it was detached, | |
# otherwise just press Ctrl+C to stop | |
# - `docker-compose down' to shutdown and drop the container (the data will continue | |
# stored in the 'mongo-data-latest' volume) | |
# - `docker volume rm mongo-data-latest' to drop the data from the volume (first | |
# execute `docker-compose down') | |
# - `~/bin/docker-volume-cp mongo-data-latest mongo-data-latest-backup-DAY' to backup the | |
# DB to a new volume |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
~/bin/docker-volume-cp
: https://gist.github.com/mrsarm/6713bfd973c2338ddada12e53487886f