1.下载redis镜像
docker pull redis
2.创建redis目录
cd /usr/local/
mkdir software
cd software
mkdir -p redis/conf redis/data redis/log
3. 进入redis/logs
vi redis.log
chmod 777 redis.log
4. 编辑redis配置文件
cd redis/config
vi redis.conf
下载redis.conf配置文件,主要修改一下几项
这一行可以自定义密码 不设置代表免密
![](https://i-blog.csdnimg.cn/blog_migrate/474f1b4a45844a000dc79c2a174e7785.png)
5 . 启动redis容器
docker run -it
--name redis_13789
--privileged
-p 6379:6379
--ip 127.0.0.1
-v /usr/local/software/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf
-v /usr/local/software/redis/data/:/data
-v /usr/local/software/redis/log/redis.log:/var/log/redis.log
--privileged=true
-d redis redis-server /usr/local/etc/redis/redis.conf
--appendonly yes