当前目录下放置redis.conf和data文件夹
其中redis.conf来源官网,修改以下配置
bind 0.0.0.0 appendonly yes protected-mode no
运行:
docker run -d -p 6379:6379 -v $PWD/redis.conf:/usr/local/etc/redis/redis.conf -v $PWD/data:/data --restart unless-stopped --name redis redis:5.0.8 redis-server /usr/local/etc/redis/redis.conf