前提:已裝好docker
1. 文件從官網 https://redis.io/ 下載壓縮包 http://download.redis.io/releases/redis-5.0.3.tar.gz ,解壓獲取 redis.conf 文件
redis.conf 配置文件,修改密碼
# requirepass foobared 更改爲 requirepass yourpassword
redis.conf 配置文件,修改可以外部訪問
bind 127.0.0.1 更改爲 # bind 127.0.0.1
protected-mode yes 更改爲 protected-mode no
2. 直接運行redis容器,docker會自動下載latest版本
docker run --name redis -p 6379:6379 -v /home/leiyunran/development/docker/redis/data:/data -v /home/leiyunran/development/docker/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf -d redis redis-server /usr/local/etc/redis/redis.conf --appendonly yes