Docker - Redis Container with JSON Module

Let's deploy a basic Redis-Stack instance with docker.

1) Config File

Create a folder and an empty redis-stack.conf file in your working directory.

mkdir config/
touch config/redis-stack.conf

I want to change two default options only.

# bind 192.168.1.100 10.0.0.1     # listens on two specific IPv4 addresses
# bind 127.0.0.1 ::1              # listens on loopback IPv4 and IPv6
# bind * -::*                     # like the default, all available interfaces

bind 192.168.65.15

# By default protected mode is enabled. You should disable it only if
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured.
protected-mode no

The instance will bind to the container IP Address and protected-mode no will allow other hosts to connect to the instance.

The configuration file will be mapped as volume to the container.

2) docker-compose.yml File

Below the container configuration file.

version: "3.8"

services:
  redis:
    image: 'redis/redis-stack:7.0.6-RC2'
    container_name: redis
    restart: always
    hostname: 'redis'
    environment:
      TZ: 'Europe/London'
    dns:
      - 192.168.65.1
    networks:
            macvlan65:
                  ipv4_address: 192.168.65.15
    ports:
      - "6379:6379"
      - "8001:8001"
    volumes:
      # Redis config file.
      - './config/redis-stack.conf:/etc/redis-stack.conf'
    logging: 
      options:
        tag: "{{.ImageName}}/{{.Name}}/{{.ID}}"
      driver: journald
networks:
  macvlan65:
          external: true
:

Use the command below to start the container.

docker-compose up -d 

3) Resources

Redis - How to Deploy

Redis - Configuration File

Redis - Docker Hub Image