Ale*_*our 7 docker docker-compose
我向我的容器添加了一个新的健康检查,如下所示:
app:
...
labels:
- autoheal=true
healthcheck:
test: ["CMD", 'curl -o /dev/null -s -w "%{http_code}\n" http://localhost:3000/health --connect-timeout 30 --max-time 30 | grep 200']
interval: 30s
timeout: 60s
retries: 3
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:601"
depends_on:
- scalyr
Run Code Online (Sandbox Code Playgroud)
但是当我输入“docker container ls”时,健康检查仍在开始:
“sh run-node” 11 分钟前 5 分钟(运行状况:正在启动)
我遇到了同样的问题,就我而言,问题是我使用的是curl,它默认情况下未安装在Alpine 图像中。
这是 wget 的等效项HEALTHCHECK(在 Alpine 中可用):
HEALTHCHECK --interval=30s --timeout=60s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11091 次 |
| 最近记录: |