[
https://issues.apache.org/jira/browse/NIFI-5955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17250872#comment-17250872
]
Ruben Laguna commented on NIFI-5955:
------------------------------------
The problem with this kind of healthcheck (/nifi) is that the UI may be up (GET
/nifi 200 OK) but the UI may still be unusable (for example the UI is a node
that is disconnected from the cluster). In [NIFI-8100] I've requested a
healthcheck endpoint that signals that the node is actually ready and healthy
so that it can be used by external load balancers, but I guess I would be also
good to use that new endpoint for the docker healthcheck.
> Provide a Docker HEALTHCHECK
> ----------------------------
>
> Key: NIFI-5955
> URL: https://issues.apache.org/jira/browse/NIFI-5955
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Docker
> Reporter: Anthony Mastrean
> Priority: Minor
> Time Spent: 4h 20m
> Remaining Estimate: 0h
>
> It takes Nifi a noticeable amount of time to become available at
> [http://localhost:8080/nifi.] We can help indicate readiness to both human
> and machine users (see
> [depends_on|https://docs.docker.com/compose/compose-file/compose-file-v2/#depends_on]
> in Compose) by establishing a HEALTHCHECK in the Dockerfile.
> The
> [documentation|https://docs.docker.com/engine/reference/builder/#healthcheck]
> suggests
> {code:java}
> HEALTHCHECK CMD curl -f http://localhost:8080/nifi || exit 1{code}
>
> But, there are [better cURL
> flags|https://explainshell.com/explain?cmd=curl+-fsSL+example.org] for
> scripts.
> {code:java}
> HEALTHCHECK CMD curl -fsSL http://localhost:8080/nifi || exit 1
> {code}
>
> And I sometimes see problems using {{localhost}} (possibly a Docker
> networking issue?). I've seen this pattern suggested elsewhere.
> {code:java}
> HEALTHCHECK CMD curl -fsSL http://$(hostname -i || echo localhost):8080/nifi
> || exit 1
> {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)