Redis:Failed opening .rdb for saving: Permission denied

  • CentOS7.5
  • I pulled redis:5.0 from dockerhub.
  • Started docker with command below:

docker run --name redis5 -v /data/db:/data -p 6379:6379 -d redis:5.0

This docker running quite well for several days. However today it suddenly report errors below:

19263:C 22 Nov 2019 02:04:49.035 # Failed opening the RDB file web (in server root dir /etc) for saving: Permission denied
1:M 22 Nov 2019 02:04:49.135 # Background saving error
1:M 22 Nov 2019 02:04:55.051 * 1 changes in 900 seconds. Saving…
1:M 22 Nov 2019 02:04:55.052 * Background saving started by pid 19264
19264:C 22 Nov 2019 02:04:55.052 # Failed opening the RDB file web (in server root dir /etc) for saving: Permission denied
1:M 22 Nov 2019 02:04:55.152 # Background saving error
1:M 22 Nov 2019 02:05:01.072 * 1 changes in 900 seconds. Saving…
1:M 22 Nov 2019 02:05:01.073 * Background saving started by pid 19265
19265:C 22 Nov 2019 02:05:01.073 # Failed opening the RDB file web (in server root dir /etc) for saving: Permission denied

My root db file is in “/data” in the container, why it try to access “/etc”? How can I fix this problem?

Thanks

i‘ve got this problem because previously redis don’t stopped completely and exists Residual Process .
you could found the port of redis already binded (in use ) at log file redis.log.
just run :
kill -9 redis-pid
restart redis service

share url : https://bit.ly/3hOnLaN

For some strange reason the value of the “dir” configuration variable has reverted to /etc.

By connecting to the redis-server and running the following cli command the problem went way temporarily:

redis-cli config set dir “/data”

Part of the problem is that when deploying the “redis:latest” image, there is no way to get to the “redis.conf” file, at least I couldn’t find it anywhere,

How can I change make sure the Parameters in the redis.conf file are correct or, alternativly, can I move the redis.conf file to the /data directory so I can edit it outside of the container?