docker-compose.yml

  1. version: "3.1"
  2. services:
  3. redis:
  4. image: redis
  5. container_name: redis
  6. restart: always
  7. environment:
  8. - TZ=Asia/Shanghai
  9. ports:
  10. - 6379:6379
  11. privileged: true
  12. volumes:
  13. - ./conf/sentinel.conf:/data/sentinel.conf
  14. - ./data:/data
  15. - ./conf/redis.conf:/usr/local/etc/redis/redis.conf
  16. - ./logs:/logs
  17. command: ["redis-server","/usr/local/etc/redis/redis.conf"]

redis.conf

  1. bind 0.0.0.0
  2. daemonize no
  3. port 6379
  4. requirepass root123
  5. logfile "/logs/redis.log"