与安装mysql类似:
docker pull redis:3.2
命令说明:
docker run -p 6379:6379
-v /home/ubuntu/vmi/myredis/data:/data
-v /home/ubuntu/vmi/myredis/conf/redis.conf:/usr/local/etc/redis/redis.conf
-d redis:3.2 redis-server /usr/local/etc/redis/redis.conf
--appendonly yes
执行命令:
docker run -p 6379:6379 -v /home/ubuntu/vmi/myredis/data:/data -v /home/ubuntu/vmi/myredis/conf/redis.conf:/usr/local/etc/redis/redis.conf -d redis:3.2 redis-server /user/local/etc/redis/redis.conf --appendonly yes
如果需要更改可在redis.conf目录下创建redis.conf文件
连接redis
docker exec -it containerID redis-cli