Skip to content

Commit

Permalink
fix(docker): reduce the chance for false positives in the health check
Browse files Browse the repository at this point in the history
In case the health check contains more detailed information where one check could report UP but the overall status is down/out of service/etc.

See https://docs.spring.io/spring-boot/docs/2.6.15/reference/html/actuator.html#actuator.endpoints.health for more.
  • Loading branch information
dbyron-sf committed May 2, 2024
1 parent 9db127a commit ad6cf9a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.java11.slim
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ COPY clouddriver-web/build/install/clouddriver /opt/clouddriver
RUN mkdir -p /opt/clouddriver/plugins && chown -R spinnaker:nogroup /opt/clouddriver/plugins

USER spinnaker
HEALTHCHECK CMD curl http://localhost:7002/health | grep UP || exit 1
HEALTHCHECK CMD curl --fail http://localhost:7002/health
CMD ["/opt/clouddriver/bin/clouddriver"]
2 changes: 1 addition & 1 deletion Dockerfile.java11.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ RUN adduser --system --uid 10111 --group spinnaker
COPY clouddriver-web/build/install/clouddriver /opt/clouddriver
RUN mkdir -p /opt/clouddriver/plugins && chown -R spinnaker:nogroup /opt/clouddriver/plugins
USER spinnaker
HEALTHCHECK CMD curl http://localhost:7002/health | grep UP || exit 1
HEALTHCHECK CMD curl --fail http://localhost:7002/health
CMD ["/opt/clouddriver/bin/clouddriver"]
2 changes: 1 addition & 1 deletion Dockerfile.slim
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ COPY clouddriver-web/build/install/clouddriver /opt/clouddriver
RUN mkdir -p /opt/clouddriver/plugins && chown -R spinnaker:nogroup /opt/clouddriver/plugins

USER spinnaker
HEALTHCHECK CMD curl http://localhost:7002/health | grep UP || exit 1
HEALTHCHECK CMD curl --fail http://localhost:7002/health
CMD ["/opt/clouddriver/bin/clouddriver"]
2 changes: 1 addition & 1 deletion Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ RUN adduser --system --uid 10111 --group spinnaker
COPY clouddriver-web/build/install/clouddriver /opt/clouddriver
RUN mkdir -p /opt/clouddriver/plugins && chown -R spinnaker:nogroup /opt/clouddriver/plugins
USER spinnaker
HEALTHCHECK CMD curl http://localhost:7002/health | grep UP || exit 1
HEALTHCHECK CMD curl --fail http://localhost:7002/health
CMD ["/opt/clouddriver/bin/clouddriver"]

1 comment on commit ad6cf9a

@xibz
Copy link
Contributor

@xibz xibz commented on ad6cf9a May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea! Totally forgot about --fail, this works great without no dependencies! Good approach :)

Please sign in to comment.