Closed thirumalaicb closed 2 years ago
Docker for Mac sometimes has some nuanced behavior https://github.com/docker/for-mac/issues/2657#issuecomment-371210749, what might work is avoiding the host mount and using a Docker named volume
The comment by @yosifkit still holds good WITHOUT any permission related error. I don't have to give any specific permission to the directory or the file, i.e. to run the sudo chown
I ran in my initial comment when opening this issue. The trick was with --entrypoint redis-server
. I may have to dig this a little further to understand what this does though, but at a later point.
OS:
Mac Monterey
Chip:M1
Image:redis:latest
Reference: I have already gone through the below issues.
Created directory and gave permission:
mkdir ~/redis
mkdir ~/redis/data
sudo chown -R 999:999 ~/redis/data
To start a container:
docker run -p 6379:6379 -v ~/redis/data:/data --name redislatest -d redis:latest
The above works well.
1:C 21 Feb 2022 23:52:55.715 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 21 Feb 2022 23:52:55.715 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 21 Feb 2022 23:52:55.715 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 21 Feb 2022 23:52:55.716 * monotonic clock: POSIX clock_gettime
1:M 21 Feb 2022 23:52:55.722 * Running mode=standalone, port=6379.
1:M 21 Feb 2022 23:52:55.722 # Server initialized
1:M 21 Feb 2022 23:52:55.764 * Loading RDB produced by version 6.2.6
1:M 21 Feb 2022 23:52:55.764 * RDB age 10033 seconds
1:M 21 Feb 2022 23:52:55.765 * RDB memory usage when created 3.89 Mb
1:M 21 Feb 2022 23:52:55.895 # Done loading RDB, keys loaded: 12509, keys expired: 0.
1:M 21 Feb 2022 23:52:55.896 * DB loaded from disk: 0.161 seconds
1:M 21 Feb 2022 23:52:55.896 * Ready to accept connections
However, when the container is stopped using
docker stop redislatest
it took some time before stopping the container, which was unusual. When I checked the logs usingdocker logs redislatest
, I found below error.1:signal-handler (1645487597) Received SIGTERM scheduling shutdown...
1:M 21 Feb 2022 23:53:17.699 # User requested shutdown...
1:M 21 Feb 2022 23:53:17.699 * Saving the final RDB snapshot before exiting.
1:M 21 Feb 2022 23:53:17.710 # Failed opening the RDB file dump.rdb (in server root dir /data) for saving: Operation not permitted
1:M 21 Feb 2022 23:53:17.710 # Error trying to save the DB, can't exit.
1:M 21 Feb 2022 23:53:17.710 # SIGTERM received but errors trying to shut down the server, check the logs for more information
Any suggestion/help?