-
Notifications
You must be signed in to change notification settings - Fork 29
/
start-redis.sh
executable file
·27 lines (21 loc) · 742 Bytes
/
start-redis.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
REDIS_IMAGE=$1
REDIS_VERSION=$2
REDIS_PORT=$3
REDIS_PASSWORD=$4
REDIS_CONTAINER_NAME=$5
REDIS_REMOVE_CONTAINER=$6
if [ -z "$REDIS_VERSION" ]; then
echo "Missing Redis version in the [redis-version] input. Received value: $REDIS_VERSION"
echo "Falling back to Redis version [latest]"
REDIS_VERSION='latest'
fi
DOCKER_RUN_ARGS="--name $REDIS_CONTAINER_NAME --publish $REDIS_PORT:6379 --detach $REDIS_IMAGE:$REDIS_VERSION"
if [ "$REDIS_REMOVE_CONTAINER" == "true" ]; then
DOCKER_RUN_ARGS="$DOCKER_RUN_ARGS --rm"
fi
if [ -n "$REDIS_PASSWORD" ]; then
DOCKER_RUN_ARGS="$DOCKER_RUN_ARGS redis-server --requirepass $REDIS_PASSWORD"
fi
echo "Starting single-node Redis instance: $DOCKER_RUN_ARGS"
docker run $DOCKER_RUN_ARGS