docker中安装redis详解

docker中安装redis详解

1、拉取redis镜像

以redis 6.2.7版本为例

docker pull redis:6.2.7

2、运行redis(简单但无持久化)

docker run -d -p 6379:6379 redis:6.2.7

3、修改redis的配置文件

先复制一份宿主机上的redis配置文件 到/app/redis/redis.conf

注释掉:bind 127.0.0.1

将daemonize yes 改为daemonize no

开启redis数据持久化 appendonly yes

关闭保护模式 protected-mode no

4、运行redis(数据卷持久化)

docker run -p 6379:6379 --name myredis --privileged=true -v /app/redis/redis.conf:/etc/redis/redis.conf -v /app/redis/data:/data -d redis:6.2.7 redis-server /etc/redis/redis.conf

你可能感兴趣的:(docker,docker,redis,bootstrap)