Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Start Redis and CouchDB from Docker container
#!/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
You can’t perform that action at this time.