1. install redis5.0 docker image

To win over the government redis5.0 image
docker pull redis:5.0.3

  Create native redis Mount directory
mkdir -p /root/redis/data /root/redis/conf
stay /root/redis/conf Create a file in the directory redis.conf
touch redis.conf
2. establish redis container
docker run -d --name redis -p 6379:6379 -v
/root/redis/conf/redis.conf:/redis.conf -v /root/redis/data:/data redis:5.0.3
redis-server --appendonly yes
-d Background operation

-p Port mapped to host port

-v Mount the host directory to the directory of the container

redis-server --appendonly yes :  Execute in container redis-server Start command , And open it redis Persistent configuration

start-up redis container
docker start redis
 

see /root/redis/data Is there any data in it

Test connection

The connection was successful

Technology