[root@localhost local]# docker run -d \
> -p 6379:6379 \
> -v /usr/local/redis/data:/data \
> -v /usr/local/redis/conf:/usr/local/etc/redis \
> --restart=always \
> --name redis6.5.13 \
> redis:6.2.13 redis-server /usr/local/etc/redis/redis.conf
10cfe56c45ab81733be138f664ba037147891e76565d41c9b74d018cd83ae728
[root@localhost local]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
10cfe56c45ab redis:6.2.13 "docker-entrypoint.s…" 4 seconds ago Restarting (1) Less than a second ago redis6.5.13
[root@localhost local]# docker logs -f 10cfe56c45ab
1:C 10 Nov 2024 08:20:11.459 # Fatal error, can't open config file '/usr/local/etc/redis/redis.conf': Permission denied
尝试过的方法: 使用--privileged=true redis.conf开777权限 root权限 全都没有用 我原本是修改了redis.conf的这个daemonize为yes
于是就会报错,修改为no即可
docker run -d \
-p 6379:6379 \
-v /usr/local/redis/data:/data \
-v /usr/local/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf \
--name redis \
redis:6.2.13 \
redis-server /usr/local/etc/redis/redis.conf
成功!
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。