安装redis
docker pull redis
创建挂载路径及配置文件
mkdir -p /mydata/redis/conf
touch /mydata/redis/conf/redis.conf
启动redis
docker run -p 6379:6379 --name redis -v /mydata/redis/data:/data \
-v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf \
-d redis redis-server /etc/redis/redis.conf
启动redis客户端测试
docker exec -it redis redis-cli
redis.conf配置持久化
appendonly yes
具体配置查看官方文档
https://redis.io/topics/config