redis部署

docker-compose.yml

version: '2.2'
services:
        redis:
                image: redis:5
                ports:
                        - 6379:6379
                container_name: redis
                restart: always
                mem_limit: 1024m
                volumes:
                        - $PWD/conf/redis.conf:/usr/local/etc/redis/redis.conf
                        - /etc/localtime:/etc/localtime:ro
                        - redis:/data
                restart: always
                command:
                        - /bin/bash
                        - -c
                        - | 
                                redis-server /usr/local/etc/redis/redis.conf
volumes:
        redis:
                external: true

redis.conf

最核心的配置

bind 0.0.0.0
requirepass xxxx ##给出复杂密码

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注