I am using official redis
image with sidekiq
on dockers
.
Following are yml
configurations for redis
image:
redis: build: . dockerfile: Dockerfile-redis ports: - '6379:6379' volumes: - 'redis:/var/lib/redis'sidekiq: build: . command: bundle exec sidekiq links: - db - redis volumes: - .:/app env_file: - .env
Following is the code of my Dockerfile-redis
:
FROM redisCOPY redis.conf /usr/local/etc/redis/redis.confCMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
When I build the images everything works fine but after sometime docker-compose logs
shows the following permission
error:
redis_1 | 98:C 22 Jan 2019 18:40:10.098 # Failed opening the RDB file dump.rdb (in server root dir /var/lib/redis) for saving: Permission deniedredis_1 | 1:M 22 Jan 2019 18:40:10.203 # Background saving error
I have tried many solutions but I am still getting this error in logs. Everytime permission is denied for redis to open dump.rdb
file. I have also followed this solution and done follwoing changes in my Dockerfile-redis
to give root
permission to redis
USER rootCMD chown -R root:root /var/lib/redis/CMD chown 777 /var/lib/redis/CMD chown 777 /var/lib/redis/dump.rdb
I have tried 755
for dir
and 644
for dbfilename
but it didn't worked for me. I also tried the above configurations of Dockerfile-redis
with redis
user but still I am getting the same permission denied
error for opening dump.rdb
file.
I don't know what I am doing wrong here. Please help me with this