拉取一個redis鏡像,要知道版本号,我的時5.0.4。這個跟關鍵,涉及到之後使用的redis.conf,要使用相同版本的。
redis.conf下載下傳位址:http://download.redis.io/releases/
docker-compose.yml:
version: '3.0'
services:
redis:
image: registry.cn-hangzhou.aliyuncs.com/safebox/redis:5.0.4
container_name: redis
ports:
- "6379:6379"
volumes:
- ./redis:/etc/redis
tty: true
redis.conf:
bind 172.0.0.1
改成
bind 0.0.0.0
進而允許遠端通路。
如果要使用密碼
修改:
#requirepass foobared
為
requirepass 123456<你的密碼>