Bitnami Redis Docker Images w/ RediSearch

Posted by Misagh Moayyed on February 10, 2023 · 5 mins read ·
Content Unavailable
Your browser is blocking content on this website. Please check your browser settings and try again.

If you are deploying Redis via Bitnami Redis Docker images, you may be interested in enabling several additional Redis modules that allow you to index and search documents stored in Redis. This post is a quick overview of how to extend and use the existing Docker base images to enhance the Bitnami Redis Docker image capabilities with search features.

This tutorial specifically requires and focuses on:

  • Redis 7.0.x
  • Docker


We will start with a convenience script that allows us to spin up containers using docker-compose:

export REDIS_VERSION=${1:-7.0.7}
echo "Running Redis docker image: $REDIS_VERSION"
docker-compose -f docker-compose.yml down >/dev/null 2>/dev/null || true
docker-compose -f docker-compose.yml up -d

Our docker-compose.yml file is quite short:

version: "3"

      context: .
        redisVersion: ${REDIS_VERSION}
    container_name: redis_server_master
      - "6379:6379"

The main element to note here is the build context where we specify the current directory for the tool to find our Dockerfile. Docker Compose will then use this Dockerfile to build an image and spin up the container. The Docker Compose reference documentation notes:

Either a path to a directory containing a Dockerfile, or a URL to a git repository. When the value supplied is a relative path, it is interpreted as relative to the location of the Compose file. This directory is also the build context that is sent to the Docker daemon.

The main building block of the deployment is defined in a Dockerfile which takes advantage of Docker’s multi-stage builds:

ARG redisVersion

FROM as redisearch
FROM bitnami/redis:$redisVersion

COPY --from=redisearch /usr/lib/redis/modules/ /usr/lib/redis/modules/

CMD ["/", "--loadmodule", "/usr/lib/redis/modules/"]

Our Dockerfile extracts the needed Redis modules from redisearch base image. Then, it will build a Docker image with bitnami/redis as the base image and will copy the extracted Redis modules into the final image. Of course, it would also have to instruct Redis to load those two modules when it runs.

Once you run the image, you can ssh into the running container, run redis-cli, and then interact with Redis modules. An example would be:> FT.CREATE myIdx ON HASH PREFIX 1 doc: SCHEMA title TEXT WEIGHT 5.0 body TEXT url TEXT

Need Help?

If you have questions about the contents and the topic of this blog post, or if you need additional guidance and support, feel free to send us a note and ask about consulting and support services.


I hope this review was of some help to you and I am sure that both this post as well as the functionality it attempts to explain can be improved in any number of ways. Please feel free to engage and contribute as best as you can.

Happy Coding,

Misagh Moayyed