Running sentinel in docker 19.03.13. On all available 6.0.x versions I got this error when sentinel tries to create new config. And sentinel works fine with 5.x.

Comment From: oranagra

@bonikforever can you please add more details? did you get any assertion? error? or crash log? did you build and configure redis yourself or download it from docker hub? could this be related to #7824 (merged into 6.0.9)? did you test an earlier version of 6.0.x?

Comment From: bonikforever

@oranagra thank for you question! This is what I get in log:

sentinel_1  | 1:X 13 Dec 2020 11:49:15.640 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
sentinel_1  | 1:X 13 Dec 2020 11:49:15.640 # Redis version=6.0.9, bits=64, commit=00000000, modified=0, pid=1, just started
sentinel_1  | 1:X 13 Dec 2020 11:49:15.640 # Configuration loaded
sentinel_1  | 1:X 13 Dec 2020 11:49:15.642 * Running mode=sentinel, port=26379.
sentinel_1  | 1:X 13 Dec 2020 11:49:15.642 # Could not create tmp config file (Permission denied)
sentinel_1  | 1:X 13 Dec 2020 11:49:15.642 # WARNING: Sentinel was not able to save the new configuration on disk!!!: Permission denied

I used image from docker hub with simple config:

protected-mode no
port 26379
dir /data
sentinel monitor myredis 192.168.1.1 6379 2
sentinel down-after-milliseconds myredis 5000
sentinel parallel-syncs myredis 1
sentinel failover-timeout myredis 10000

And error raised when sentinel tries to update confg.

I couldn't say anything about C code but this error happens only in 6.0.9. In 6.0.8 and earlier it doesn't.

Command to run:

chown 999 ./sentinel.conf
docker run --rm -v $(pwd)/sentinel.conf:/usr/local/etc/redis/sentinel.conf redis:6.0.9 redis-server /usr/local/etc/redis/sentinel.conf --sentinel

Comment From: yossigo

Hi @bonikforever, thanks for reporting this. This is a result of a bugfix that introduced a regression when the directory where the configuration file resides cannot be written to (which is more or less the case with a single file bindmount).

You can work around this easily by bind mounting the entire directory. For example:

mkdir -p ${PWD}/sentinel_conf
chmod -R 0777 ${PWD}/sentinel_conf
docker run -v ${PWD}/sentinel_conf:/usr/local/etc/redis redis:6.0.9 redis-server /usr/local/etc/redis/sentinel.conf --sentinel

Comment From: bonikforever

@yossigo you right, directory with config must be writable.

Comment From: fclever1122

I have just encountered the same problem. The error report in the log is the same. Thank you for your answer and solved my problem. @yossigo