docker pull redis
建立配置文件
mkdir -p /opt/mydata/redis/conf \
vi /opt/mydata/redis/conf/redis.conf
再redis.conf中填写配置信息
bind 0.0.0.0
appendonly yes
requirepass redis123
运行容器
docker run -p 6379:6379 --name redis \
-v /opt/mydata/redis/data:/data \
-v /opt/mydata/redis/conf/redis.conf:/etc/redis/redis.conf \
-d redis redis-server /etc/redis/redis.conf