在Docker下安装Redis

2022/4/15 Docker

拉取镜像

docker pull redis
1

运行redis-server容器

docker run --name redis-server \
--restart=always \
--net host \
-p 6379:6379 \
-v /opt/redis/data:/data \
-d redis \
redis-server --appendonly yes --save 60 1 --loglevel warning
1
2
3
4
5
6
7

进入redis-cli客户端

docker exec -it 33bfe9767642 redis-cli
1

https://registry.hub.docker.com/_/redis (opens new window)