How to fix redis redis-1 Failed opening the temp RDB file ... for saving: Permission denied
Problem
In your docker-based redis setup, you see the following error message:
13:C 13 Jul 2024 01:59:10.966 # Failed opening the temp RDB file temp-13.rdb (in server root dir /data) for saving: Permission denied
Solution
You need to fix the permissions of the /data
directory in your redis container.
Likely, you mounted the directory as volume similar to our Minimal Redis Docker-Compose Template :
services:
redis:
image: redis:7-alpine
user: 1000:1000
# [...]
volumes:
- ./redis_data:/data # <--
In your docker-compose.yml
, look for the /data
volume (./redis_data
in this case).
Also, you need to find out which user ID / group ID redis
is running under (1000:1000
in this case).
Then, you need to set the permissions of the /data
directory to the correct user ID / group ID:
chown -R 1000:1000 redis_data
There is no need to restart redis after this as the error should disappear immediately.