我正在运行我的春季引导web应用程序作为码头服务,它运行良好,没有健康检查。
但是,当我尝试创建带有健康检查选项的对接服务时,我的服务会在一段时间后(可能在健康暂停之后)自动重新启动,而且它永远不会稳定。
我创建了\health rest端点,并且简单地返回ok,这里是命令,我用它来创建带有健康检查选项的服务,并且没有它。
命令与健康检查选项:
sudo docker service create \
--health-cmd="curl --silent --fail localhost:8090/health || exit 1" \
--health-interval=5s \
--health-retries=12 \
--health-timeout=2s \
--health-start-period=60s \
--name=my-service \
-p "8090:8090" \
my-docker-img产出:
s43fbah1qdlxb01s4x5veecos
overall progress: 0 out of 1 tasks
1/1: starting [============================================> ] 未经健康检查的命令:
sudo docker service create \
--name=my-service \
-p "8090:8090" \
my-docker-img我的春季引导应用程序需要20多个才能启动和运行。
发布于 2018-10-03 12:46:17
确保容器中安装了"curl“。--health-cmd="curl --silent --fail localhost:8090/health || exit 1"可能会失败。其他一切看起来都很好。
下面的命令将帮助您调试此问题。您将能够看到日志:
sudo docker inspect --format='{{json .State.Health}}' [container-name-or-id]https://stackoverflow.com/questions/52626437
复制相似问题