Redis service docker-compose health check

Published on 2022-12-17 • Modified on 2022-12-17

This snippet shows how to put in place a health check for a docker Redis service in a docker-compose file. There is the ping function of Redis, which is precisely what we need in this case.

# Cache ——————————————————————————————————————————————————————————————————————
# Redis (official image)
    container_name: strangebuzz-redis-1
    image: redis:5.0.13-alpine
      - '6389:6379'
      test: ["CMD-SHELL", "redis-cli -h ping | grep 'PONG' || exit 1"]
      interval: 10s
      timeout: 30s
      retries: 10

 More on Stackoverflow   Read the doc  More on the web  Random snippet

  Work with me!