docker安装 redis

一、使用docker安装redis简介


安装命令根据实际部署情况调整

版本地址:官方镜像主页 | 发布版Tags
最新版本命令: docker pull redis:latest
指定版本命令: docker pull redis:7.0.0
文档更新记录:2021/01/27 当前最新稳定版本6.0.10
文档更新记录:2021/01/27 当前最新稳定版本6.2.3
文档更新记录:2022/05/06 当前最新稳定版本7.0.0


二、安装(以下安装配置为6.2.3版本的)

1、Docker安装点击此处,如果已经安装则跳过

2、安装redis

redis.conf配置文件下载6.0.10
redis.conf配置文件下载6.2.3

$ docker pull redis:6.2.3
$ mkdir -p /opt/docker/redis/{data,conf}
# 将下载redis.conf.rar解压下来,将redis.conf拷贝到/opt/docker/redis/conf/文件夹下(注意!!!redis.conf里边的daemonize yes一定要是no,不然启动不了)
$ docker run \
-p 端口:6379 \
-v /opt/docker/redis/data:/data:rw \
-v /opt/docker/redis/conf/redis.conf:/etc/redis/redis.conf:ro \
--privileged=true \
--name redis-47 \
-d redis:6.2.3 redis-server /etc/redis/redis.conf
#备注:
    1)9603为访问端口
    2)/opt/docker/redis/conf/redis.conf为配置文件,要提前上传好
    3)默认密码是password123,自己的密码请在文件redis.conf中提前修改好,对应字段requirepass
    3)进入redis容器的命令:docker exec -it redis-47 /bin/bash
posted @ 2021-01-27 17:19  王子健  阅读(249)  评论(0编辑  收藏  举报