Docker install Redis

Install

1. Download Redis

1
docker pull redis

2. Create configuration file

1
2
3
mkdir -p /mydata/redis/conf

touch /mydata/redis/conf/redis.conf

3. Create an instance and start

1
2
3
4
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

Configure

1. Configure redis persistence

1
2
3
echo "appendonly yes"  >> /mydata/redis/conf/redis.conf

docker restart redis

2. The container runs automatically with docker startup

1
docker update redis --restart=always

3. View running containers

1
docker ps

Docker install Redis
https://www.hardyhu.cn/2022/01/23/Docker-install-Redis/
Author
John Doe
Posted on
January 23, 2022
Licensed under