参考:
https://blog.csdn.net/qq_34690079/article/details/136687113
https://www.jb51.net/server/321831fyj.htm
https://blog.csdn.net/qq_30166465/article/details/139428244
默认会保存一个dump.rdb文件在 /var/lib/redis路径下,可以通过docker-compose.yaml配置修改volume以挂载相应路径:
version: "3.1"
services:
stock_backtest_docker:
build: # 构建自定义镜像
context: ./ # 指定dockerfile文件的所在路径
dockerfile: Dockerfile # 指定Dockerfile文件名称
restart: always
container_name: stock_backtest
ports:
- "8089:80"
# - "8082:8082"
volumes:
- ./ruoyi-admin:/home/ruoyi/ruoyi-admin
- ./ruoyi-common:/home/ruoyi/ruoyi-common
- ./ruoyi-framework:/home/ruoyi/ruoyi-framework
- ./ruoyi-generator:/home/ruoyi/ruoyi-generator
- ./ruoyi-quartz:/home/ruoyi/ruoyi-quartz
- ./ruoyi-system:/home/ruoyi/ruoyi-system
- ./ruoyi-moviemonitor:/home/ruoyi/ruoyi-moviemonitor
- ./ruoyi-ui:/home/ruoyi/ruoyi-ui
- ./pom.xml:/home/ruoyi/pom.xml
- ./nginx_conf/conf.d:/etc/nginx/conf.d
- ./nginx_conf/nginx.conf:/etc/nginx/nginx.conf
- ./bin/start.sh:/start.sh
- ./bin/redis.sh:/redis.sh
- ./logs:/home/ruoyi/logs
- ./redis-dump:/var/lib/redis
# 映射地区
# - /etc/localtime:/etc/localtime
# - /etc/timezone:/etc/timezone:ro
注意:此时的redis-dump文件夹需要给较低的权限,例如chmod 777 redis-dump,避免redis无法写入文件。