Source

version: '3.9'

services:
    redis:
      image: library/redis:latest
      deploy:
        resources:
          limits:
            memory: 256M
            cpus: '0.75'
          reservations:
            memory: 50M
      healthcheck:
        test: ["CMD-SHELL", "redis-cli ping || exit 1"]
      user: 1000:1000
      ports:
        - 6379:6379
      volumes:
        - /mnt/docker/data/redis/data:/data
        - /mnt/docker/data/redis/config:/usr/local/etc/redis
      environment:
        - PUID=1000
        - PGID=1000
        - TZ=Etc/UTC