This is an automated archive made by the Lemmit Bot.

The original was posted on /r/selfhosted by /u/ElevenNotes on 2025-07-17 14:16:53+00:00.


DISCLAIMER FOR REDDIT USERS ⚠️

  • You’ll find the source code for the image on my github repo: 11notes/redis or at the end of this post
  • You can debug distroless containers. Check my RTFM/distroless for an example on how easily this can be done
  • If you prefer the original image or any other image provider, that is fine, it is your choice and as long as you are happy, I am happy
  • No, I don’t plan to make a PR to the original image, because that PR would be huge and require a lot of effort and I have other stuff to attend to than to fix everyones Docker images
  • No AI was used to write this post or to write the code for my images! The README.md is generated by my own github action based on the project.md template, there is no LLM involved, even if you hate emojis

INTRODUCTION 📢

For developers, who are building real-time data-driven applications, Redis is the preferred, fastest, and most feature-rich cache, data structure server, and document and vector query engine.

SYNOPSIS 📖

What can I do with this? This image will run redis rootless and distroless for more security. Besides being more secure and slim than most images, it also offers additional start parameters to either start Redis in command mode, as a replica or as a in-memory database that persists nothing to disk. Simply provide the command needed:

COMMANDS 📟

  • –cmd - Will execute all commands against the Redis database specified via REDIS_HOST environment variable
  • –replica MASTER - Will start as replica from MASTER (can be IP, FQDN or container DNS)
  • –in-memory - Will start Redis only in memory
  • 1 - … and more?

UNIQUE VALUE PROPOSITION 💶

Why should I run this image and not the other image(s) that already exist? Good question! Because …

  • … this image runs rootless as 1000:1000
  • … this image has no shell since it is distroless
  • … this image is auto updated to the latest version via CI/CD
  • … this image has a health check
  • … this image runs read-only
  • … this image is automatically scanned for CVEs before and after publishing
  • … this image is created via a secure and pinned CI/CD process
  • … this image is very small
  • … this image can be used to execute commands after redis has started

If you value security, simplicity and optimizations to the extreme, then this image might be for you.

COMPARISON 🏁

Below you find a comparison between this image and the most used or original one.

image 11notes/redis:7.4.5 redis:7.4.5
image size on disk 5.71MB 117MB
process UID/GID 1000/1000 0/0
distroless?
rootless?

COMPOSE ✂️

name: "kv"

x-image-redis: &image
 image: "11notes/redis:7.4.5"
 read\_only: true

services:
 redis:
 <<: \*image
 environment:
 REDIS\_PASSWORD: "${REDIS\_PASSWORD}"
 TZ: "Europe/Zurich"
 networks:
 backend:
 volumes:
 - "redis.etc:/redis/etc"
 - "redis.var:/redis/var"
 tmpfs:
 - "/run:uid=1000,gid=1000"
 restart: "always"

# start a replica
 replica:
 <<: \*image
 environment:
 REDIS\_PASSWORD: "${REDIS\_PASSWORD}"
 TZ: "Europe/Zurich"
 command: "--replica redis"
 networks:
 backend:
 volumes:
 - "replica.etc:/redis/etc"
 - "replica.var:/redis/var"
 tmpfs:
 - "/run:uid=1000,gid=1000"
 restart: "always"

# start Redis only in-memory
 in-memory:
 <<: \*image
 environment:
 REDIS\_PASSWORD: "${REDIS\_PASSWORD}"
 TZ: "Europe/Zurich"
 command: "--in-memory"
 networks:
 backend:
 volumes:
 - "in-memory.etc:/redis/etc"
 tmpfs:
 - "/run:uid=1000,gid=1000"
 restart: "always"

# execute CLI commands via redis-cli
 cli:
 <<: \*image
 depends\_on:
 redis:
 condition: "service\_healthy"
 restart: true
 environment:
 REDIS\_HOST: "redis"
 REDIS\_PASSWORD: "${REDIS\_PASSWORD}"
 TZ: "Europe/Zurich"
 # start redis in cmd mode
 entrypoint: ["/usr/local/bin/redis", "--cmd"]
 # commands to execute in order
 command: 
 - PING
 - --version
 - SET key value NX
 - GET key
 networks:
 backend:

# demo container to actually view the databases
 gui:
 image: "redis/redisinsight"
 environment:
 RI\_REDIS\_HOST0: "redis"
 RI\_REDIS\_PASSWORD0: "${REDIS\_PASSWORD}"
 RI\_REDIS\_HOST1: "replica"
 RI\_REDIS\_PASSWORD1: "${REDIS\_PASSWORD}"
 RI\_REDIS\_HOST2: "in-memory"
 RI\_REDIS\_PASSWORD2: "${REDIS\_PASSWORD}"
 TZ: "Europe/Zurich"
 ports:
 - "3000:5540/tcp"
 networks:
 backend:
 frontend:

volumes:
 redis.etc:
 redis.var:
 replica.etc:
 replica.var:
 in-memory.etc:

networks:
 frontend:
 backend:
 internal: true

SOURCE 💾

1: Sentinel mode will follow soon as well as the possibility to change the announce IP and port