美文网首页
docker-compose方式安装redis 5.x

docker-compose方式安装redis 5.x

作者: TechLogs | 来源:发表于2020-04-25 10:27 被阅读0次

    准备docker-compose.yml文件

    version: "3.1"
    services:
      redis:
        image: daocloud.io/library/redis:5.0.4
        restart: always
        container_name: redis
        environment:
          - TZ=Asia/Shanghai
        ports:
          - 6379:6379
        volumes:
          - ./redis/redis-5.0.4/redis.conf:/usr/local/etc/redis/redis.conf
          - ./redis/redis-5.0.4/data/:/data
        command: ["redis-server","/usr/local/etc/redis/redis.conf"]
    

    挂载配置文件及data数据目录说明

    http://download.redis.io/releases/redis-5.0.4.tar.gz
    解压压缩包,并且将redis.conf文件取出,放到指定位置.

        volumes:
          - ./redis/redis-5.0.4/redis.conf:/usr/local/etc/redis/redis.conf
          - ./redis/redis-5.0.4/data/:/data
    

    修改redis.conf配置文件

    1、将本地ip注释
    # bind 127.0.0.1
    2、关闭保护机制
    protected-mode no
    

    相关文章

      网友评论

          本文标题:docker-compose方式安装redis 5.x

          本文链接:https://www.haomeiwen.com/subject/eeyhwhtx.html