1、获取 redis 镜像
docker pull redis
2、查看本地镜像
docker images
3、从官网获取 redis.conf 配置文件
mkdir /opt/docker/redis/conf cd /opt/docker/redis/conf //进入目录 wget http://download.redis.io/redis-stable/redis.conf //下载redis配置文件 vim redis.conf //修改配置文件
3、docker 启动 redis
docker run -p 8379:6379 --name redis -v /opt/docker/redis/conf/redis.conf:/etc/redis/redis.conf -v /opt/docker/redis/data:/data -d redis redis-server /etc/redis/redis.conf --appendonly yes
4、查看redis状态
5、进入redis
docker exec -it redis /bin/bash
原文:https://www.cnblogs.com/fangts/p/14717452.html