mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2024-11-22 00:31:01 +00:00
20 lines
No EOL
512 B
Bash
Executable file
20 lines
No EOL
512 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -x
|
|
set -eo pipefail
|
|
|
|
# if a redis container is running, print instructions to kill it and exit
|
|
RUNNING_CONTAINER=$(docker ps --filter 'name=redis' --format '{{.ID}}')
|
|
if [[ -n $RUNNING_CONTAINER ]]; then
|
|
echo >&2 "there is a redis container already running, kill it with"
|
|
echo >&2 " docker kill ${RUNNING_CONTAINER}"
|
|
exit 1
|
|
fi
|
|
|
|
# Launch Redis using Docker
|
|
docker run \
|
|
-p "6379:6379" \
|
|
-d \
|
|
--name "redis_$(date '+%s')" \
|
|
redis:7
|
|
|
|
>&2 echo "Redis is ready to go!" |