x-defaults: &defaults restart: unless-stopped logging: driver: json-file options: max-size: 100m max-file: "3" services: valkey: <<: *defaults image: ${GLOBAL_REGISTRY:-}valkey/valkey:${VALKEY_VERSION:-8.0-alpine} ports: - "${VALKEY_PORT_OVERRIDE:-6379}:6379" volumes: - valkey_data:/data # Use a custom valkey.conf file # - ./valkey.conf:/etc/valkey/valkey.conf environment: - TZ=${TZ:-UTC} command: - sh - -c - | if [ -n "$${VALKEY_PASSWORD}" ]; then valkey-server --requirepass "$${VALKEY_PASSWORD}" --appendonly yes else valkey-server --appendonly yes fi deploy: resources: limits: cpus: '0.50' memory: 512M reservations: cpus: '0.25' memory: 256M healthcheck: test: ["CMD", "valkey-cli", "ping"] interval: 10s timeout: 3s retries: 3 start_period: 5s volumes: valkey_data: