1,docker 拉去redis镜像
docker pull redis
2,创建实例并启动
mkdir -p /mydata/redis/conf
touch /mydata/redis/conf/redis.conf
docker run -p 6379:6379 --name redis01 -v /mydata/redis/data:/data -v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf -d redis redis-server /etc/redis/redis.conf
3,进入redis容器客户端
docker exec -it redis01 redis-cli
4,配置redis 开启AOF持久化
vi /mydata/redis/conf/redis.conf
appendonly yes
5,重新启动容器
docker restart redis01
6,设置容器自启动
docker update redis01 --restart=always