Docker安装Redis
1. 拉取镜像
docker pull redis
2. 查看镜像
docker images
3. 配置文件
- 创建目录
mkdir /usr/local/redis
- 下载配置文件
wget -P /usr/local/redis http://download.redis.io/redis-stable/redis.conf
- 修改配置文件
vim /usr/local/redis/redis.conf
bind 127.0.0.1 限制redis只能本地访问,#注释后所有Ip都可以访问
4. 启动容器
docker run -d --name redis -p 6379:6379 -v /usr/local/redis/redis.conf:/etc/redis/redis.conf redis redis-server /etc/redis/redis.conf --appendonly yes --requirepass '1234'
5. 安装完成,测试连接