Skip to content

Install Redis 7 Using Docker Compose

Create file with below content and name ~/config/redis_api_maker.yml

version: "3.7"

networks:
    redis_api_maker-network:
        driver: bridge

services:
    redis_api_maker:
        image: 'redis:7.0.5-alpine'
        restart: always
        container_name: redis_api_maker
        environment:
            - REDIS_PORT_NUMBER=6379
        ports:
            - '6379:6379'
        command: redis-server --loglevel warning --requirepass 2a7taehscqk_LgJHNHZM # 👈 Change this
        volumes:
            - ~/docker-data/redis_api_maker:/data
        networks:
            - redis_api_maker-network
        logging:
            driver: "json-file"
            options:
                max-size: "5m"
                max-file: "3"

Start redis container

/usr/bin/docker-compose --project-name api_maker -f ~/config/redis_api_maker.yml up -d

Stop redis container

/usr/bin/docker-compose --project-name api_maker -f ~/config/redis_api_maker.yml stop