1.编写docker-compose文件,并建好对应文件夹
version: '3.1'
services:
redis:
image: redis:latest
container_name: redis
restart: always
ports:
- 30022:6379
volumes:
- /data/projects/redis/data:/data
- /data/projects/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf
network_mode: bridge
command: redis-server /usr/local/etc/redis/redis.conf
2 编辑redis.conf文件
下载redis配置文件
wget https://raw.githubusercontent.com/antirez/redis/5.0/redis.conf -O redis.conf
注释掉这两个配置项,以实现外网访问
bind
protected-mode yes
3 ### 启动
docker-compose up
网友评论