services: cache: image: redis:8.4.2-alpine restart: always ports: - "${REDIS_PORT}:6379" # port_on_public:port_in_docker_container command: redis-server --save 20 1 --loglevel warning --requirepass ${REDIS_PASSWORD} volumes: - cache:/data environment: - REDIS_PASSWORD=${REDIS_PASSWORD} # Optional, if you will use it in the container - REDIS_PORT=${REDIS_PORT} volumes: cache: driver: local