Docker安装Redis
1,拉取镜像
docker pull redis
2,启动容器
注:请先上传redis.conf文件至/home/redis/conf中
redis.conf 链接: https://pan.baidu.com/s/1yPfgwVvvM_m8kR7nkupSmA 提取码: ssm7
redis镜象 链接: https://pan.baidu.com/s/1Hysy1eWq3qx70mPLpK29cQ 提取码: twg6
docker run --name redis -d -p 6379:6379 -v /home/redis/conf:/etc/redis/conf -v /home/redis/data:/data -v /etc/localtime:/etc/localtime:ro redis redis-server /etc/redis/conf/redis.conf --appendonly yes --"123456x"
注:
redis-server /etc/redis/redis.conf 指定用配置文件的方式启动redis
–appendonly yes 开启持久化
测试: docker exec -it redis /bin/bash redis-cli set test 1 get test