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) # https://hub.docker.com/_/redis redis: container_name: strangebuzz-redis-1 image: redis:5.0.13-alpine ports: - '6389:6379' healthcheck: test: ["CMD-SHELL", "redis-cli -h 127.0.0.1 ping | grep 'PONG' || exit 1"] interval: 10s timeout: 30s retries: 10
More on Stackoverflow Read the doc More on the web Random snippet