1,拉取镜像
2,启动容器
注:请先上传redis.conf文件至/home/redis/conf中
redis.conf 链接: https://pan.baidu.com/s/1yPfgwVvvM_m8kR7nkupSmA 提取码: ssm7
redis镜象 链接: https://pan.baidu.com/s/1Hysy1eWq3qx70mPLpK29cQ 提取码: twg6
docker run --name redis -d -p 6379:6379 -v /home/redis/conf:/etc/redis/conf -v /home/redis/data:/data -v /etc/localtime:/etc/localtime:ro redis redis-server /etc/redis/conf/redis.conf --appendonly yes --"123456x"
注:
redis-server /etc/redis/redis.conf 指定用配置文件的方式启动redis
–appendonly yes 开启持久化
测试:
docker exec -it redis /bin/bash
redis-cli
set test 1
get test
本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。