How to use docker to download redis and make its data persistent?

1. Download the
docker pull redis(latest version of the image file )
2. Create an instance and start it

mkdir -p /mydata/redis/conf
touch redis.conf   //手工创建redis.conf
touch /mydata/redis/conf/redis.conf
/**将redis中的配置文件映射到linux的目录下,方便以后配置*/
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
persistence
is added to the redis.conf file

appendonly yes

redis readme file:
https//:raw.githubusercontent.com/antirez/redis/4.0/redis.conf

Guess you like

Origin blog.csdn.net/lq1759336950/article/details/113620864