services: redis: image: redis:8-alpine restart: unless-stopped command: - redis-server - --requirepass - ${REDIS_PASSWORD:-dev} - --appendonly - "yes" - --maxmemory - 256mb - --maxmemory-policy - allkeys-lru environment: # redis-cli reads the password from this variable, so the health check can authenticate. REDISCLI_AUTH: ${REDIS_PASSWORD:-dev} ports: - "127.0.0.1:6379:6379" volumes: - redis-data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 10 volumes: redis-data: