I am using the redis docker image. In docker-entrypoint.sh
, it has these lines that forces the container to be run as redis
user.
# allow the container to be started with `--user`
if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then
chown -R redis .
exec su-exec redis "$0" "$@"
fi
The problem is it causes permission problem when I want to create a folder at /
to store the socket file.
Opening Unix socket: bind: Permission denied
The only folder that redis
has permission to is /data/
which isn't a good place to store socket file and to be accessed by other container. How do I bypass the if
block to run redis as root?
(I am aware there is a similar question, but it isn't answered. Also the condition is different. I am using the official docker image so I can't do anything to the Dockerfile.)