Sign inSign up

dekadev/redis-stateless

By dekadev

•Updated 4 months ago

Stateless Redis for cache-only workloads. No RDB, No AOF. Corrupt? Restart = fresh start.

Image
0

660

dekadev/redis-stateless repository overview

⁠Redis Stateless

Custom Redis Docker image optimized for cache-only workloads. No persistence, no corruption headaches.

When Redis data is used purely as cache, persisting it to disk is unnecessary and creates a failure point — RDB/AOF files can corrupt, causing Redis to refuse startup. This image eliminates that problem entirely.

⁠How It Works

FeatureDefault RedisThis Image
RDB snapshotssave 3600 1 ...Disabled (save "")
AOF persistenceappendonly yesDisabled (appendonly no)
On corrupt dataFails to startStarts fresh (auto-cleanup)
Memory policynoevictionallkeys-lru (cache-optimized)
Default maxmemoryunlimited1gb

When the container restarts, the entrypoint script automatically removes any leftover persistence files (dump.rdb, appendonly.aof) before starting Redis — ensuring a clean start every time.

⁠Supported Versions

VersionBuild TagBase Image
7.27.2redis:7.2-alpine
8.28.2 (default)redis:8.2-alpine
8.68.6redis:8.6-alpine

⁠Quick Start

⁠Build
# Build default (8.2)
docker build -t redis-stateless .

# Build specific version
docker build --build-arg REDIS_VERSION=7.2-alpine -t redis-stateless:7.2 .
docker build --build-arg REDIS_VERSION=8.2-alpine -t redis-stateless:8.2 .
docker build --build-arg REDIS_VERSION=8.6-alpine -t redis-stateless:8.6 .
⁠Run
# Basic
docker run -d --name redis-cache -p 6379:6379 redis-stateless

# With password
docker run -d --name redis-cache -p 6379:6379 redis-stateless --requirepass mypassword

# Override maxmemory
docker run -d --name redis-cache -p 6379:6379 redis-stateless --maxmemory 512mb

# With docker-compose (all 3 versions for testing)
docker compose up -d
⁠Docker Compose

The included docker-compose.yml starts all three versions for local testing:

ServiceVersionPort
redis-7-27.26400
redis-8-28.26401
redis-8-68.66402
docker compose up -d          # Start all
docker compose up -d redis-8-2  # Start specific version
docker compose down           # Stop all

⁠Deploy on Coolify

  1. Push this repository to your Git provider (GitHub, GitLab, etc.)
  2. In Coolify: New Resource → Dockerfile
  3. Configure:
    • Build Arg REDIS_VERSION → choose version (default: 8.2-alpine)
    • No persistent volume needed — this is a stateless image
  4. Set environment variables in Coolify as needed:
    • REDIS_ARGS → extra Redis server arguments (e.g. --requirepass secret)
  5. Deploy
⁠Environment Variables

This image relies on Coolify's control plane for environment variable management. You can pass extra arguments to redis-server by overriding the CMD:

# In Coolify or docker-compose
command: ["--requirepass", "your-password", "--maxmemory", "512mb"]

⁠Default Configuration

# No persistence
save ""
appendonly no

# Memory
maxmemory 1gb
maxmemory-policy allkeys-lru

# Lazy freeing (non-blocking deletes)
lazyfree-lazy-eviction yes
lazyfree-lazy-expire yes
lazyfree-lazy-server-del yes

# Network
bind 0.0.0.0
protected-mode no

⁠Why Stateless?

Common failure scenario with default Redis:

Redis crash → corrupt dump.rdb → Redis refuses to start → application down
→ Manual intervention needed: delete dump.rdb, restart Redis, lose data anyway

With this image:

Redis crash → container restarts → entrypoint deletes leftover files → Redis starts fresh
→ Application resumes immediately, no manual intervention

For cache workloads, this is the correct tradeoff — cached data is inherently ephemeral.

⁠Health Check

Built-in health check runs every 10 seconds:

redis-cli ping → expects PONG

Docker reports container health status automatically. Use with orchestrators (Docker Swarm, Kubernetes, Coolify) for automatic restart on failure.

⁠License

MIT

Tag summary

Content type

Image

Digest

sha256:f02638e12…

Size

26.5 MB

Last updated

4 months ago

docker pull dekadev/redis-stateless