docker安装redis
1、查看可用的 Redis 版本
查看可用版本:docker search
[root@luoxiaoshuai ~]# docker search redis
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
redis Redis is an open source key-value store that… 9024 [OK]
bitnami/redis Bitnami Redis Docker Image 171 [OK]
sameersbn/redis 82 [OK]
grokzen/redis-cluster Redis cluster 3.0, 3.2, 4.0, 5.0, 6.0 75
rediscommander/redis-commander Alpine image for redis-commander - Redis man… 52 [OK]
kubeguide/redis-master redis-master with "Hello World!" 33
redislabs/redisearch Redis With the RedisSearch module pre-loaded… 30
redislabs/redis Clustered in-memory database engine compatib… 27
oliver006/redis_exporter Prometheus Exporter for Redis Metrics. Supp… 23
redislabs/rejson RedisJSON - Enhanced JSON data type processi… 23
arm32v7/redis Redis is an open source key-value store that… 22
redislabs/redisinsight RedisInsight - The GUI for Redis 19
bitnami/redis-sentinel Bitnami Docker Image for Redis Sentinel 19 [OK]
redislabs/redisgraph A graph database module for Redis 13 [OK]
webhippie/redis Docker images for Redis 11 [OK]
arm64v8/redis Redis is an open source key-value store that… 10
s7anley/redis-sentinel-docker Redis Sentinel 10 [OK]
insready/redis-stat Docker image for the real-time Redis monitor… 9 [OK]
redislabs/redismod An automated build of redismod - latest Redi… 9 [OK]
centos/redis-32-centos7 Redis in-memory data structure store, used a… 5
circleci/redis CircleCI images for Redis 5 [OK]
clearlinux/redis Redis key-value data structure server with t… 3
tiredofit/redis Redis Server w/ Zabbix monitoring and S6 Ove… 1 [OK]
wodby/redis Redis container image with orchestration 1 [OK]
xetamus/redis-resource forked redis-resource
2、取最新版的 Redis 镜像
拉取官方的最新版本的镜像:docker pull redis:latest
[root@luoxiaoshuai ~]# docker pull redis:latest
latest: Pulling from library/redis
a076a628af6f: Already exists
f40dd07fe7be: Pull complete
ce21c8a3dbee: Pull complete
ee99c35818f8: Pull complete
56b9a72e68ff: Pull complete
3f703e7f380f: Pull complete
Digest: sha256:0f97c1c9daf5b69b93390ccbe8d3e2971617ec4801fd0882c72bf7cad3a13494
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest
3、查看本地镜像
查看本地镜像:docker images
[root@luoxiaoshuai ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest c8562eaf9d81 4 days ago 546MB
redis latest 621ceef7494a 9 days ago 104MB
4、运行容器
运行 redis容器:docker run -itd --name redis-test -p 6379:6379 redis
[root@luoxiaoshuai ~]# docker run -itd --name redis-test -p 6379:6379 redis
0ceaa975529dd84d52ec4fe2130d917f5b36cd6ad2a64dbe7433c268a6c004bc
参数说明:
-p 6379:6379:映射容器服务的 6379 端口到宿主机的 6379 端口。外部可以直接通过宿主机ip:6379 访问到 Redis 的服务。
5、安装成功
查看容器的运行信息:docker ps
[root@luoxiaoshuai ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest c8562eaf9d81 4 days ago 546MB
redis latest 621ceef7494a 9 days ago 104MB
然后我们通过 redis-cli 连接测试使用 redis 服务。
docker exec -it redis-test /bin/bash
[root@luoxiaoshuai ~]# docker exec -it redis-test /bin/bash
root@0ceaa975529d:/data# redis-cli
127.0.0.1:6379> set test 1
OK
127.0.0.1:6379> get test
"1"
127.0.0.1:6379>
6.用redis相关工具连接:
本人用的是:Another Redis Desktop Manager
发现连接成功!!!
百度网盘redis工具提取:https://pan.baidu.com/s/1nzJQ2NYSuaGS69VC8-oiYg
(Another-Redis-Desktop-Manager.1.3.7.exe和redis-desktop-manager-0.8.8.384.exe)
m/s/1nzJQ2NYSuaGS69VC8-oiYg
(Another-Redis-Desktop-Manager.1.3.7.exe和redis-desktop-manager-0.8.8.384.exe)
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-B5fyvKyj-1611372583912)(C:\Users\Le’novo\AppData\Roaming\Typora\typora-user-images\image-20210123112826534.png)]