一、下载redis
docker pull redis
二、启动redis 温馨提示,启动前先创建好文件夹
mkdir
-p
/mydata
/redis
/conf
touch
/mydata
/redis
/conf
/redis
.conf
echo "appendonly yes" >>
/mydata
/redis
/conf
/redis
.conf
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开启自启动
docker update redis
--restart=always
转载请注明原文地址:https://tech.qufami.com/read-18073.html