Files
dockerfiles/redis/docker-entrypoint.sh
T
Qi Zheng 3259d3bab3 Use su-exec to run commands on entryponit
With su-exec, make sure the SIGTERM upon docker stop
could be received by the running program thus causing
a clean stop/exit.

Signed-off-by: Qi Zheng <qi.zheng@intel.com>
2019-07-23 15:47:45 -07:00

16 lines
325 B
Bash

#!/bin/sh
set -e
# first arg is `-f` or `--some-option`
# or first arg is `something.conf`
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
set -- redis-server "$@"
fi
# change to redis user to run
if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then
exec su-exec redis "$BASH_SOURCE" "$@"
fi
exec "$@"