zoukankan      html  css  js  c++  java
  • docker安装部署redis用dockercompose启动设置密码

    搜索镜像

    [root@localhost ~]# docker search redis
    NAME                             DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
    redis                            Redis is an open source key-value store that…   10202     [OK]       
    sameersbn/redis                                                                  83                   [OK]
    grokzen/redis-cluster            Redis cluster 3.0, 3.2, 4.0, 5.0, 6.0, 6.2      80                   
    rediscommander/redis-commander   Alpine image for redis-commander - Redis man…   70                   [OK]
    redislabs/redisearch             Redis With the RedisSearch module pre-loaded…   41                   
    redislabs/redisinsight           RedisInsight - The GUI for Redis                35                   
    kubeguide/redis-master           redis-master with "Hello World!"                33                   
    oliver006/redis_exporter          Prometheus Exporter for Redis Metrics. Supp…   31                   
    redislabs/redis                  Clustered in-memory database engine compatib…   31                   
    redislabs/rejson                 RedisJSON - Enhanced JSON data type processi…   31                   
    arm32v7/redis                    Redis is an open source key-value store that…   25                   
    arm64v8/redis                    Redis is an open source key-value store that…   19                   
    redislabs/redisgraph             A graph database module for Redis               17                   [OK]
    redislabs/rebloom                A probablistic datatypes module for Redis       16                   [OK]
    redislabs/redismod               An automated build of redismod - latest Redi…   15                   [OK]
    webhippie/redis                  Docker image for redis                          11                   [OK]
    s7anley/redis-sentinel-docker    Redis Sentinel                                  10                   [OK]
    insready/redis-stat              Docker image for the real-time Redis monitor…   10                   [OK]
    redislabs/redistimeseries        A time series database module for Redis         10                   
    goodsmileduck/redis-cli          redis-cli on alpine                             9                    [OK]
    centos/redis-32-centos7          Redis in-memory data structure store, used a…   6                    
    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                           0                    [OK]

    拉取镜像

    [root@localhost ~]# docker pull redis
    Using default tag: latest
    latest: Pulling from library/redis
    eff15d958d66: Pull complete
    1aca8391092b: Pull complete
    06e460b3ba1b: Pull complete
    def49df025c0: Pull complete
    646c72a19e83: Pull complete
    db2c789841df: Pull complete
    Digest: sha256:619af14d3a95c30759a1978da1b2ce375504f1af70ff9eea2a8e35febc45d747
    Status: Downloaded newer image for redis:latest
    docker.io/library/redis:latest

    设置docker-compose.yml配置

    [root@localhost bin]# vi docker-compose.yml

    version: '3'
    services:
      redis:
        image: redis:latest
        restart: always
        container_name: redis
        command:
          - /bin/bash
          - -c
          - redis-server /usr/local/bin/redis.conf/redis.conf --requirepass "xxxxxxxx"
        privileged: true
        ports:
          - "0.0.0.0:6379:6379"
        volumes:
          - ./redis/data:/data
          - ./redis/redis.conf:/usr/local/bin/redis.conf/redis.conf

    创建Redis容器

    [root@localhost bin]# docker-compose up -d

    Creating redis         ... done
    [root@localhost bin]# docker ps -a
    CONTAINER ID    IMAGE                       COMMAND                    CREATED              STATUS              PORTS                                           NAMES
    e558e25c45bb     redis:latest                "docker-entrypoint.s…"    13 minutes ago     Up 13 minutes     0.0.0.0:6379->6379/tcp                    redis

    本机客户端登录

    root@e558e25c45bb:/usr/local/bin#
    root@e558e25c45bb:/usr/local/bin# ./redis-cli -h 127.0.0.1 -p 6379 -a "xxxxxx"
    Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
    127.0.0.1:6379> ping
    PONG
    127.0.0.1:6379>


  • 相关阅读:
    VB连接Mysql数据库
    SASS优化响应式断点管理
    图像切割之(五)活动轮廓模型之Snake模型简单介绍
    Ubuntu的力量何在?
    开机黑屏 仅仅显示鼠标 电脑黑屏 仅仅有鼠标 移动 [已成功解决]
    thrift之默认传输类TTransportDefaults和虚拟传输类TVirtualTransport
    Java实现 蓝桥杯VIP 算法训练 水仙花数
    Java实现 蓝桥杯VIP 算法训练 求指数
    Java实现 蓝桥杯VIP 算法训练 求指数
    Java实现 蓝桥杯VIP 算法训练 求指数
  • 原文地址:https://www.cnblogs.com/xiaweicn/p/15604072.html
Copyright © 2011-2022 走看看