[
https://issues.apache.org/jira/browse/NIFI-5955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16740800#comment-16740800
]
Anthony Mastrean commented on NIFI-5955:
----------------------------------------
OK, I think I have a Dockerfile that works with any ports.
> 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: 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
(v7.6.3#76005)