docker pull redis
2.运行镜像docker run -p 6379:6379 --name redis -v /home/database/redis/redis.conf:/etc/redis/redis.conf -v /home/database/redis/data:/data -d redis redis-server /etc/redis/redis.conf --appendonly yes --requirepass "123456"
命令说明: -p 6379:6379:将主机的6379端口映射到docker容器的6379端口。--name redis:运营服务名称-v /home/database/redis/redis.conf:/etc/redis/redis.conf :文件挂载-v /home/database/redis/data:/data:文件挂载--requirepass "123456":初始化密码。-d redis redis-server /etc/redis/redis.conf: 代表后台操作容器 /etc/redis/redis.conf:操作指定的配置文件–requirepass "123456" :设置密码
3.查看日志docker ps
docker logs 961