Kitloft

All tools / Docker Compose examples

Redis with Docker Compose

Redis with a password, append-only persistence on a named volume, and a health check.

Customize names, versions and passwords →

compose.yaml
services:
  redis:
    image: redis:7.4
    restart: unless-stopped
    command: ["redis-server", "--appendonly", "yes", "--requirepass", "change-me"]
    volumes:
      - redis-data:/data
    ports:
      - "127.0.0.1:6379:6379"
    healthcheck:
      test: ["CMD-SHELL", "redis-cli --no-auth-warning -a 'change-me' ping | grep PONG"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  redis-data:

Passwords here are placeholders (change-me). The generator creates random ones for you.

How to use it

Commands
docker compose up -d
docker compose ps
docker compose logs -f

Prefer Kubernetes? See the Redis Kubernetes version.