Nginx 健康检查命令
services:
nginx:
image: nginx:1.19.10
#....忽略其他....
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1"]
interval: 10s
timeout: 5s
retries: 5
test
说明:模拟HTTP协议访问http://127.0.0.1/
返回的HTTP STATUS 状态码为200则检查通过timeout
说明:执行test最大等待时间,超时后也表示失败;默认为30sinterval
说明: 轮询时间间隔 10s 表示每隔10秒执行一次;默认为30sretries
说明:重试次数,失败后多少次重试nginx的检查方式适合所有HTTP协议的应用检查,例如Java spring boot的tomcat
test: ["CMD", "curl", "-f", "http://127.0.0.1:8080"]
http://blog.xqlee.com/article/2503291634118268.html