准备docker-compose.yml文件
version: "3.1"
services:
redis:
image: daocloud.io/library/redis:5.0.4
restart: always
container_name: redis
environment:
- TZ=Asia/Shanghai
ports:
- 6379:6379
volumes:
- ./redis/redis-5.0.4/redis.conf:/usr/local/etc/redis/redis.conf
- ./redis/redis-5.0.4/data/:/data
command: ["redis-server","/usr/local/etc/redis/redis.conf"]
挂载配置文件及data数据目录说明
http://download.redis.io/releases/redis-5.0.4.tar.gz
解压压缩包,并且将redis.conf文件取出,放到指定位置.
volumes:
- ./redis/redis-5.0.4/redis.conf:/usr/local/etc/redis/redis.conf
- ./redis/redis-5.0.4/data/:/data
修改redis.conf配置文件
1、将本地ip注释
# bind 127.0.0.1
2、关闭保护机制
protected-mode no
网友评论