docker 配置 redis

docker run --name redis5.0.9 -itd 
-p 6379:6379 
-e "TZ=Asia/Shanghai" 
-v ~/Desktop/redis/data:/data 
-v ~/Desktop/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf 
redis:5.0.9 redis-server /usr/local/etc/redis/redis.conf

注意:
redis 镜像没有提供 redis.conf 文件,所以需要到官网下载一份 redis.conf 文件。
redis 镜像启动需要在命令行指定 conf 文件在容器中的位置
需要修改 redis.conf 中 bind 才可以在宿主机访问

原文地址:https://www.cnblogs.com/manastudent/p/12922938.html