Ubuntu 下Docker中安装Redis并启动
一.拉取Image
docker search redis
docker pull redis
docker images
![](https://img2020.cnblogs.com/blog/1172315/202112/1172315-20211219142621402-647869232.png)
![](https://img2020.cnblogs.com/blog/1172315/202112/1172315-20211219142622256-1655160201.png)
![](https://img2020.cnblogs.com/blog/1172315/202112/1172315-20211219142623925-111352626.png)
二.拉取Redis配置
cd /usr/local
mkdir redis
cd redis
wget http://download.redis.io/redis-stable/redis.conf
![](https://img2020.cnblogs.com/blog/1172315/202112/1172315-20211219142624318-1490277472.png)
![](https://img2020.cnblogs.com/blog/1172315/202112/1172315-20211219142624620-1925714654.png)
三.启动docker Redis
docker run --name redis -d -p 6379:6379 -v /usr/local/redis/redis.conf:/etc/redis.conf redis redis-server /etc/redis.conf
docker exec -it redis /bin/bash #进入容器
redis-cli #连接redis
![](https://img2020.cnblogs.com/blog/1172315/202112/1172315-20211219142625078-369433679.png)
查看redis 已经在运行了