windows10中docker desktop安装使用redis服务流程步骤
windows10+docker环境作为开发测试环境还是非常方便的,下面介绍一下在该环境下redis服务安装使用的流程步骤。
拉取最新的redis镜像
C:\Users\htz>docker pull redis
Using default tag: latest
latest: Pulling from library/redis
1efc276f4ff9: Pull complete
adf5288e41ff: Pull complete
2f387b0b685f: Pull complete
1b3d2bd4ccba: Pull complete
937c39fc1973: Pull complete
751dcbc45baa: Pull complete
Digest: sha256:9bc34afe08ca30ef179404318cdebe6430ceda35a4ebe4b67d10789b17bdf7c4
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest
在宿主机上创建redis映射配置文件,就是-v 参数
我这里是测试就不建了
启动redis容器
C:\Users\htz>docker run -d -p 6379:6379 --name redis-server redis
2ae8b9c9388918f30faf576704b9c2c42bf14b4e75529740c32be026af6f4df0
查看一下镜像、容器
C:\Users\htz>docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest 7b94cda7ffc7 4 days ago 446MB
redis latest 3e42dd4e79c7 5 days ago 117MB
nginx latest 605c77e624dd 7 months ago 141MB
C:\Users\htz>docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2ae8b9c93889 redis "docker-entrypoint.s…" 5 seconds ago Up 4 seconds 0.0.0.0:6379->6379/tcp redis-server
49e037a8f292 nginx "/docker-entrypoint.…" 2 hours ago Up 2 hours 0.0.0.0:8088->80/tcp nginx-server
626d1e27cb13 mysql "docker-entrypoint.s…" 2 days ago Exited (255) 4 hours ago 0.0.0.0:3306->3306/tcp, 33060/tcp mysql-server
测试客户端软件连接一下
比如:redisclient、Another Redis Desktop Manager等
我这里用redisclient
Server->add->里面有Name/Host/Port/Password填上就ok了
我这里直接127.0.0.1 密码为空,确定就进来了
其他知识
redis持久化配置参数:--appendonly yes;
redis配置密码登录参数:--requirepass "123456";
redis自动启动参数:--restart=always;
...
相关文章