docker 安装redis 注意事项

一. redis配置文件修改(重要)

~/redis.conf 中daemonize=NO。非后台模式,如果为YES 会的导致 redis 无法启动,因为后台会导致docker无任务可做而退出。

三 执行docker

docker run --name="redis-2" -d -p 6378:6379 -v /home/fr/redis:/opt royfans/redis:v1 /usr/local/redis/bin/redis-server /usr/local/redis/redis.conf --appendonly yes

1. -p 6378:6379  容器redis 端口6379 映射 宿主机未6378

2. --name redis容器 名字 为 redis01

3. -v /home/fr/redis:/opt   会将宿主机的配置文件复制到docker中。

 重要: 配置文件映射,docker镜像redis 默认无配置文件。

5.-d redis  后台模式启动 redis 

6. redis-server /etc/redis/redis.conf    redis 将以 /etc/redis/redis.conf 为配置文件启动
7. --appendonly yes  开启redis 持久化

重要:  docker 镜像reids 默认 无配置文件启动

 
posted @ 2019-07-02 13:18  RoyFans  阅读(1507)  评论(0编辑  收藏  举报