Docker swarm 堆栈文件 healthcheck 命令没有按预期工作
Docker swarm stack file healthcheck command does not work as expected
我遇到了以下问题:
容器是运行以下健康检查配置(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
在运行时我看到只考虑了 healthcheck 测试命令的第一部分 (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
CMD-SHELL
接受一个参数,字符串被传递给处理字符串解析的 shell:
test: ["CMD-SHELL", "curl -s -X GET http://127.0.0.1:5000/actuator/health | grep 'UP'"]
我遇到了以下问题:
容器是运行以下健康检查配置(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
在运行时我看到只考虑了 healthcheck 测试命令的第一部分 (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
CMD-SHELL
接受一个参数,字符串被传递给处理字符串解析的 shell:
test: ["CMD-SHELL", "curl -s -X GET http://127.0.0.1:5000/actuator/health | grep 'UP'"]