标签: docker-healthcheck

在 docker-compose.yml 中设置健康检查的“开始间隔”

我正在使用 Docker Compose 部署一些服务。我想检查我的容器是否运行正常(请参阅此处的healthcheckDocker Compose 文档)。

\n

让我们考虑以下代码。它工作正常,除非我取消注释最后一行:

\n
# docker-compose.yml\n\nversion: "3.8"\n\nservices:\n  postgres:    # this is just an example, please don\'t focus on that particular image\n    image: postgres:15-alpine\n    healthcheck:\n      test: pg_isready -d my_db -U my_user    # again, the command here is not my point, nor the env, feel free to change it\n      interval: 60s\n      start_period: 30s\n      # start_interval: 5s # \xe2\x86\x92 this line is commented because it raises an error! Why?\n
Run Code Online (Sandbox Code Playgroud)\n

Dockerfile 文档的此页面描述了指令中各种设置之间的差异HEALTHCHECK。 …

docker docker-compose health-check docker-healthcheck

10
推荐指数
1
解决办法
3080
查看次数