Created
September 3, 2015 23:44
-
-
Save joaoneto/d6866f80dafbfbd743b4 to your computer and use it in GitHub Desktop.
Start Redis and CouchDB from Docker container
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
#!/bin/bash | |
docker-machine start default 1> /dev/null | |
eval "$(docker-machine env default)" | |
RUNNING=$(docker inspect --format="{{ .State.Running }}" redis 2> /dev/null) | |
if [ $? = 1 ]; then | |
echo "Container redis doesn\'t exists" | |
docker run -d -p 6379:6379 -v `pwd`/data/redis:/data --name redis redis | |
fi | |
if [ "$RUNNING" = "false" ]; then | |
echo "Starting redis container" | |
docker start redis 1> /dev/null | |
else | |
echo "Container redis is running" | |
fi | |
RUNNING=$(docker inspect --format="{{ .State.Running }}" couchdb 2> /dev/null) | |
if [ $? = 1 ]; then | |
echo "Container couchdb doesn't exists" | |
docker run -d -p 5984:5984 -v `pwd`/data/couchdb:/usr/local/var/lib/couchdb --name couchdb klaemo/couchdb | |
fi | |
if [ "$RUNNING" = "false" ]; then | |
echo "Starting couchdb container" | |
docker start couchdb 1> /dev/null | |
else | |
echo "Container couchdb is running" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment