码迷,mamicode.com
首页 > 其他好文 > 详细

Docker安装Redis

时间:2020-02-08 17:46:34      阅读:59      评论:0      收藏:0      [点我收藏+]

标签:port   hat   exe   hello   library   docker安装   eth   struct   osi   

参考资料:https://www.runoob.com/docker/docker-install-redis.html

 

1. 查找Docker Hub上的Redis镜像

  命令:docker search redis

[root@localhost docker]# docker search redis
NAME                             DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
redis                            Redis is an open source key-value store that…   7788                [OK]                
bitnami/redis                    Bitnami Redis Docker Image                      136                                     [OK]
sameersbn/redis                                                                  79                                      [OK]
grokzen/redis-cluster            Redis cluster 3.0, 3.2, 4.0 & 5.0               62                                      
rediscommander/redis-commander   Alpine image for redis-commander - Redis man…   33                                      [OK]
kubeguide/redis-master           redis-master with "Hello World!"                31                                      
redislabs/redis                  Clustered in-memory database engine compatib…   24                                      
redislabs/redisearch             Redis With the RedisSearch module pre-loaded…   20                                      
arm32v7/redis                    Redis is an open source key-value store that…   20                                      
oliver006/redis_exporter          Prometheus Exporter for Redis Metrics. Supp…   18                                      
webhippie/redis                  Docker images for Redis                         10                                      [OK]
insready/redis-stat              Docker image for the real-time Redis monitor…   9                                       [OK]
s7anley/redis-sentinel-docker    Redis Sentinel                                  9                                       [OK]
bitnami/redis-sentinel           Bitnami Docker Image for Redis Sentinel         9                                       [OK]
redislabs/redisgraph             A graph database module for Redis               9                                       [OK]
arm64v8/redis                    Redis is an open source key-value store that…   8                                       
redislabs/redismod               An automated build of redismod - latest Redi…   6                                       [OK]
centos/redis-32-centos7          Redis in-memory data structure store, used a…   4                                       
frodenas/redis                   A Docker Image for Redis                        2                                       [OK]
circleci/redis                   CircleCI images for Redis                       2                                       [OK]
runnable/redis-stunnel           stunnel to redis provided by linking contain…   1                                       [OK]
wodby/redis                      Redis container image with orchestration        1                                       [OK]
tiredofit/redis                  Redis Server w/ Zabbix monitoring and S6 Ove…   1                                       [OK]
xetamus/redis-resource           forked redis-resource                           0                                       [OK]
cflondonservices/redis           Docker image for running redis                  0                                       

 

2. 拉取官方的镜像,要最新版

  命令:docker pull redis:latest

[root@localhost docker]# docker pull redis:latest
latest: Pulling from library/redis
bc51dd8edc1b: Pull complete 
37d80eb324ee: Pull complete 
392b7748dfaf: Pull complete 
48df82c3534d: Pull complete 
2ec2bb0b4b0e: Pull complete 
1302bce0b2cb: Pull complete 
Digest: sha256:7b84b346c01e5a8d204a5bb30d4521bcc3a8535bbf90c660b8595fad248eae82
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest

 

3. 等待下载完成后,我们就可以在本地镜像列表里查到REPOSITORY为redis,版本为latest的镜像

[root@192 docker]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
redis               latest              44d36d2c2374        6 days ago          98.2MB

 

4. 运行镜像

  命令:docker run -itd --name zh-redis -p 6379:6379 redis

[root@192 docker]# docker run -itd --name zh-redis -p 6379:6379 redis
f7ac74b4928e7c06c55ae90d2ff2cbb79875a70ffbb735896643f31e74aeacdd

  命令说明:

  --name : 镜像的名称  

  -p 3306:3306:将容器的 3306 端口映射到主机的 3306 端口。

  

5. 查看容器启动情况

[root@192 docker]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
f7ac74b4928e        redis               "docker-entrypoint.s…"   12 seconds ago      Up 11 seconds       0.0.0.0:6379->6379/tcp   zh-redis

 

6. 进入容器并操作Redis

[root@192 docker]# docker exec -it zh-redis /bin/bash
root@f7ac74b4928e:/data# redis-cli
127.0.0.1:6379> set test 1
OK

 

Docker安装Redis

标签:port   hat   exe   hello   library   docker安装   eth   struct   osi   

原文地址:https://www.cnblogs.com/huanshilang/p/12283947.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!