laradock 添加 redis 配置

导语

今天想去修改 redis 的配置,才发现默认安装的时候并无添加 redis 的配置。因此重装配置下。redis

修改 Dockerfile

编辑 redis/Dockerfile 以下docker

FROM redis:latest

LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"

## For security settings uncomment, make the dir, copy conf, and also start with the conf, to use it
RUN mkdir -p /usr/local/etc/redis
COPY redis.conf /usr/local/etc/redis/redis.conf

VOLUME /data

EXPOSE 6379

CMD ["redis-server", "/usr/local/etc/redis/redis.conf"]
#CMD ["redis-server"]

编辑配置文件

默认状况 redis 目录下有 redis.conf 文件,修改如下两点便可ui

  1. 注释 bind 127.0.0.1
  2. protected-mode 改成 no

其余配置根据本身状况进行修改。code

重装 redis

  1. 切换到 laradock 目录
  2. 中止 redis docker-compose stop redis
  3. 重装 docker-compose build --no-cache redis
  4. 启动 docker-compose up -d redis

正常状况就启动成功了。server


参考资料:laradock redis 配置记录redis解决(DENIED Redis is running in protected mode because prote)blog

相关文章
相关标签/搜索