healthcheck
配置一个检查,来确定运行服务的容器状态是否为healthy。
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40sinterval, timeout和start_period指定为持续时间。
test必须是一个字符串或列表。如果是列表,第一个元素必须是NONE,CMD或CMD-SHELL。如果是字符串,则等同于下面通过字符串指定的CMD-SHELL。
# Hit the local web app
test: ["CMD", "curl", "-f", "http://localhost"]如上所述,但是被包裹在/bin/sh 中。下面两种形式是相等的。
test: ["CMD-SHELL", "curl -f http://localhost || exit 1"]test: curl -f https://localhost || exit 1如果要禁用默认健康检查的设置,可以使用disable: true。这等同于test: ["NONE"]。
Last updated
Was this helpful?