Friday, July 24, 2015

Docker Redis

1) Create a script as such:
CONTAINER_NAME="redis_server"
REDIS_DATA_DIR="`pwd`/data-dir/redis/"
HOST_PORT_1="6379"

if [ ! -d "${REDIS_DATA_DIR}" ]
then
    mkdir -p "${REDIS_DATA_DIR}"
fi

docker rm ${CONTAINER_NAME}
docker run --name ${CONTAINER_NAME} --rm \
   -p ${HOST_PORT_1}:6379 \
   -v ${REDIS_DATA_DIR}:/data \
    redis

No comments: