我正在使用 Docker Compose 部署一些服务。我想检查我的容器是否运行正常(请参阅此处的healthcheckDocker Compose 文档)。
让我们考虑以下代码。它工作正常,除非我取消注释最后一行:
\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?\nRun Code Online (Sandbox Code Playgroud)\nDockerfile 文档的此页面描述了指令中各种设置之间的差异HEALTHCHECK。 …