Docker redis container passed dump.rdb File for data migration or data recovery
Pull redis image
#Pull the latest redis image
$docker pull redis
Enter the old redis container to save the data
$docker exec -it old_aley_redis redis-cli
127.0.0.1:6379>save
Copy dump.rdb file
The Save command will generate dump.rdb If you don’t know where to save the generated file, you can use theDocker inspect container name
Check the source value of container information under mounts to see the save location
$ docker run -it --name aley_redis -v /home/aley/data/dump.rdb:/data/dump.rdb -p 6379:6379 redis:latest /bin/bash
$ redis-server
The redis image pulled directly has no configuration file. You need to download the configuration file yourself. The download address of the configuration file is:http://download.redis.io/redis-stable/redis.conf. Mount the modified configuration file to the container. Then specify the configuration file when starting redis service.
$ $ docker run -it --name aley_redis -v /home/aley/data/redis.conf:/data/redis.conf -p 6379:6379 redis:latest /bin/bash
$ redis-server /data/redis.conf