Closed mut3 closed 9 years ago
I had previously had issues bind-mounting other containers due to SELinux, but I had expected that and had already executed
# chcon -Rt svirt_sandbox_file_t /redis/
on my local machine. I confirmed that this was not a SELinux caused issue with
# setenforce 0
and then trying to launch the same command. I got the same result.
For the following problem solving steps I will note a few things:
include
functionality of redis conf files, so I actually want to mount a directory/redis-settings/
as my mount point to make my life easierSome short googling found me some useful older issues:
That last one was the most helpful.
I guessed (correctly) that this was a permission issue within the container so:
# docker run --rm --name red-1-container -p 6379:6379 -v /redis/conf/:/redis-settings/ chown -Rv redis:redis /redis-settings/
ownership of `/redis-settings/redis.conf' retained as redis:redis
ownership of `/redis-settings/redis2.conf' retained as redis:redis
ownership of `/redis-settings/redis1.conf' retained as redis:redis
ownership of `/redis-settings/' retained as redis:redis
The owner of the directory was correct and the files are where they are supposed to be, what's the issue then?
# docker run --rm --name red-1-container -p 6379:6379 -v /redis/conf/:/redis-settings/ redis whoami
root
well thats not right. I'm supposed to be running the server as redis:redis.
# docker run --rm --name red-1-container -p 6379:6379 -v /redis/conf/:/redis-settings/ redis gosu redis:redis redis-server /redis-settings/redis1.conf
I'm not sure exactly where the problem resides, but redis does not seem to be taking the custom config file and stepping down correctly and is instead trying to do something as root when the container firmly wants that action to be executed by redis:redis.
hm should this issue have been opened here https://github.com/docker-library/redis instead?
Oh, probably :neutral_face:. I think your PR to fix the docs will be sufficient. 'Twas just the missing redis-server
anyway.
I was having a similar issue with Linux 18.04 LTS and Redis Container 6.0-alpine3.12:
root@vmi528359:~# docker start -a redis 1:C 15 Jun 2021 13:30:48.775 # Fatal error, can't open config file '/usr/local/etc/redis/redis.conf': Permission denied
were I was -v /home/redis_conf:/usr/local/etc/redis/ and placing the redis.conf file in it.
Nothing I did with chmod from the host side worked out. The only turnaround was @mut3's, by running a temporarly container to change user and group.
I would suggest trying a dedicated support forum, such as the Docker Community Forums, the Docker Community Slack, or Stack Overflow for help figuring out where your deployment has gone wrong.
On the Redis dockerhub page, this line is given as a means of using a host machine stored configuration file as the redis config at run.
however if i run
i get
if I run
a default configured redis container launches perfectly, but i want to use my configuration file without writing my own Dockerfile
CentOS 7 Docker 1.6.2 redis:latest
I did a bunch of troubleshooting and hacked around to get it working, Ill document that below to leave a clear division between problem and workaround/hack.