• Docker安装Redis


    参考资料: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
  • 相关阅读:
    HDU4825/5536 [01 字典树/简单字典树更新]
    HDU 2017 多校联合Contest 3
    51nod 多重背包 [二进制优化]
    UVa 123042D Geometry 110 in 1! [平面几何]
    UVA 11796Dog Distance[平面几何]
    洛谷P1004 方格取数[多维dp]
    HDU 1576 A/B [逆元]
    POJ1006 中国剩余定理
    HDU 1573~3579 X问题&Hello Kiki[同余方程]
    一元线性同余方程组
  • 原文地址:https://www.cnblogs.com/huanshilang/p/12283947.html
Copyright © 2020-2023  润新知