Redis image based on Alpine Linux with built-in healthcheck.
100K+
Docker Hubโ - Quay.ioโ - bfren ecosystemโ
Redisโ server, configured with environment variables. It is built on Alpine + S6โ , with Redis from Alpine's packages - each Redis version uses the newest Alpine release that has it.
It is meant to be used inside a private Docker network, by other containers - for example as the cache or metadata store for Sendโ . By default anyone who can reach port 6379 can use it, so don't publish the port unless you set a password.
services:
redis:
image: quay.io/bfren/redis:redis8
restart: unless-stopped
volumes:
- ./v/redis:/data
app:
image: your/app
environment:
- REDIS_HOST=redis
This example is also in docker-compose.ymlโ .
Run docker compose up -d - your app connects to redis:6379. To use the Redis CLI:
docker compose exec redis redis-cli
/data with Redis's default snapshot schedule, and optional append-only fileredis (UID 1000), not rootImages are published to Docker Hub (bfren/redis) and Quay.io (quay.io/bfren/redis) for linux/amd64, linux/arm/v7 and linux/arm64.
| Tag | Example | Use when |
|---|---|---|
redisN | redis8 | You want the latest image for a Redis version - recommended |
redisN.M | redis8.8 | You want the latest image for a Redis minor version |
redisN.M.R | redis8.8.0 | You want an exact Redis release |
redisN-VERSION | redis8-8.0.3 | You want to pin this image exactly |
redisN.M-VERSION | redis8.8-8.0.3 | You want to pin both |
latest, 8, 8.0, 8.0.3 | As above, on Redis 8 |
A new MAJOR version means a breaking change. Before moving to one, read the changelogโ , where each breaking change is marked Breaking.
| Redis | Release | Alpine |
|---|---|---|
| 8 | 8.8.0 | 3.24 |
| 7 | 7.2.11 | 3.21 |
Use Redis 8 for anything new - Redis 7 is kept for apps that need it.
| Port | Purpose |
|---|---|
6379 | Redis |
| Volume | Purpose |
|---|---|
/data | Snapshots (dump.rdb) and the append-only file, owned by redis (UID / GID 1000). |
| Variable | Values | Description | Default |
|---|---|---|---|
BF_REDIS_PASS | string | Clients must authenticate with this password (requirepass). | |
BF_REDIS_BIND | addresses | Only listen on these addresses, separated by spaces - leave empty to listen on all interfaces. | |
BF_REDIS_PROTECTED_MODE | no, yes | Redis's protected mode - with yes, only local clients can connect unless a password or bind address is set. | no |
BF_REDIS_LOG_LEVEL | debug, verbose, notice, warning | Log level. | notice |
BF_REDIS_MAX_CLIENTS | number | Most clients connected at once. | 10000 |
BF_REDIS_APPEND_ONLY | no, yes | Also keep an append-only file, so less is lost if Redis stops suddenly - see persistenceโ . | no |
BF_REDIS_APPEND_FSYNC | no, everysec, always | How often the append-only file is written to disk. | everysec |
See Alpine + S6โ for BF_DEBUG, BF_TZ and the other base image variables.
On every start /etc/redis/redis.conf is generated from the environment variables, then redis-server runs under S6 as redis. The container stops if Redis crashes.
Redis saves a snapshot of the data to /data/dump.rdb using its default schedule: after an hour if at least 1 key changed, after 5 minutes if 100 changed, and after a minute if 10,000 changed. With BF_REDIS_APPEND_ONLY=yes every write is also logged, so at most about a second is lost (with everysec). Mount a volume at /data to keep the data when the container is replaced.
The health check (every 30 seconds) runs redis-cli ping against the first address in BF_REDIS_BIND, or the container's address if that is empty, and passes BF_REDIS_PASS if it is set.
Redis warns at start-up if memory overcommit is turned off, as background saves (which fork the process) may then fail when memory is low. This is a kernel setting, so it can't be changed from inside the container - set it on the Docker host:
sudo sysctl vm.overcommit_memory=1
echo 'vm.overcommit_memory = 1' | sudo tee /etc/sysctl.d/99-overcommit.conf
./test.nu # builds Redis 8 and runs /test
./test.nu 7 # or any version directory
./test.nu --all # every version, in parallel
./run.sh 8 # builds and opens a shell
./generate-dockerfiles.sh # regenerates the Dockerfiles from Dockerfile.esh
/test runs this image's tests alongside the base images' tests: the generated redis.conf (defaults, settings, bind address, password and snapshots), how the health check chooses its address and password, and the installed Redis version.
NOAUTH Authentication requiredBF_REDIS_PASS is set - give the same password to your app.
Check the app uses the Redis container's name and port 6379, on the same Docker network. If BF_REDIS_BIND is set, Redis only listens on those addresses.
Mount a volume at /data. Snapshots are only taken on Redis's schedule, so turn on BF_REDIS_APPEND_ONLY if losing the last few minutes matters.
WARNING Memory overcommit must be enabled!See Host configurationโ .
Only if something outside Docker needs Redis, and then set BF_REDIS_PASS and publish it to 127.0.0.1 only (e.g. "127.0.0.1:6379:6379"). Redis is not designed to be exposed to the internet.
redis.conf is generated on every start, so changes to it are lost. Instead, build your own image with a changed template:
overlay/etc/bf/templates/redis.conf.eshโ from this repository to the same path in your image's overlay folder, and change it.FROM quay.io/bfren/redis:redis8
COPY ./overlay /
The template is used on every start, so your settings are kept.
Copyright (c) 2020-2026 bfrenโ (unless otherwise stated)
Content type
Image
Digest
sha256:7a5f391e7โฆ
Size
28 MB
Last updated
1 day ago
docker pull bfren/redis