Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

healthCheck not working #1580

Open
mghlag opened this issue Jul 5, 2022 · 4 comments · May be fixed by #1736
Open

healthCheck not working #1580

mghlag opened this issue Jul 5, 2022 · 4 comments · May be fixed by #1736

Comments

@mghlag
Copy link

mghlag commented Jul 5, 2022

Description

When both healthcheck and wait/healthy are configured, I get this error:
“Can not wait for healthstate of [busybox:latest] "healthybox1". No HEALTHCHECK configured.”
I don't include code snippets because this happens even if I run the official sample project (linked below).
If I only have a healthCheck section defined, without wait/healthy then the container starts but the healthcheck is missing so the error seems to indicate the true issue correctly - somehow the healthcheck is not created from the definition.

Info

  • docker-maven-plugin version : 0.40.1
  • Maven version (mvn -v) : 3.6.3
  • Docker version : 4.10.0 (82025)
  • If it's a bug, how to reproduce : run sumple project
  • Sample project : [GitHub Clone URL]
@rhuss
Copy link
Collaborator

rhuss commented Jul 29, 2022

Sounds indeed like a bug. Could you look into the generated Dockerfile, i.e. target/docker/imagename/build ? Actually when I run it in samples/healtchecks, the HEALTHCHECKS are generated as requested:

FROM busybox
HEALTHCHECK CMD curl -f http://localhost/ || exit 1
CMD sleep 2

@mghlag
Copy link
Author

mghlag commented Jul 29, 2022

Yes, that's the outcome of the docker:build but can you actually run docker:start with success?

@rhuss
Copy link
Collaborator

rhuss commented Jul 29, 2022

You are right, the samples are broken.

The samples have probably only been created to check whether the images are probably built, not running. E.g. in busybox, no HTTP server is running, so the check with curl will always fail.

Also, the timing parameters are not well chosen. I.e., a sleep 2 is far too small. According to the Docker documentation, the health check by default only kicks in after 30s, so any other timeout that is shorter will prevent the health check to run.

The section has a default timeout of 10 seconds, too short for a default healthcheck to kick in.

So, for now you have several options:

  • Reduce the time until the first health check is run by Docker via the option interval (see https://dmp.fabric8.io/#build-healthcheck). Set this shorter than the 10s timeout for the <wait>
  • Increase the timeout for <wait> by setting e.g. <time>35000</time>. That would be longer than the first check to start.

But as mentioned, there are issues and possibilities to improve:

  • Increase the timeout for <wait> automatically to be larger than the interval of a possible <healthcheck> condition (and larger than 30s if no interval is provided)
  • Allow <time> to be specified with a unit like other timing parameters (providing it as milliseconds does not align with e.g. second based numbers used elsewhere.
  • Fix the samples that they use real health check that succeed (e.g. just exit 0) or failed (eg. exit 1) and tune the parameters accordingly.

@DaHoC
Copy link

DaHoC commented Jan 29, 2023

I encounter the same issue "No HEALTHCHECK configured". The proposed options did not make it work for me. I cannot even get the linked samples to compile using mvn install (and after doing a successful docker login):

[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.40.3:start (start) on project dmp-sample-healthcheck: I/O Error: Unable to pull 'busybox1:latest' : {"message":"pull access denied for busybox1, repository does not exist or may require 'docker login': denied: requested access to the resource is denied"} (Not Found: 404) -> [Help 1]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants