我面临以下问题:
容器正在使用以下运行状况检查配置运行(有问题的test
)
healthcheck:
test: ["CMD-SHELL", "curl -s -X GET http://127.0.0.1:5000/actuator/health", "|", "grep 'UP'"]
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
在运行时中,我看到仅考虑运行状况检查测试命令(curl -s -X GET http://127.0.0.1:5000/actuator/health
)的第一部分。
端点回答状态为:关闭,但通过了健康检查-"Status": "healthy"
:
docker inspect 1f074dc72c6d | grep -i -A 10 health
"Health": {
"Status": "healthy",
"FailingStreak": 0,
"Log": [
{
"Start": "2019-12-10T11:37:46.215783033Z",
"End": "2019-12-10T11:37:46.315844469Z",
"ExitCode": 0,
"Output": "{\"status\": \"DOWN\"}"
},
{
"Start": "2019-12-10T11:38:16.346253717Z",
--
"Healthcheck": {
"Test": [
"CMD-SHELL",
"curl -s -X GET http://127.0.0.1:5000/actuator/health",
"|",
"grep 'UP'"
],
"Interval": 30000000000,
"Timeout": 3000000000,
"StartPeriod": 10000000000,
"Retries": 3
答案 0 :(得分:0)
CMD-SHELL
接受一个参数,字符串被传递给处理该字符串的shell:
test: ["CMD-SHELL", "curl -s -X GET http://127.0.0.1:5000/actuator/health | grep 'UP'"]