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

It takes ~30s for the container to be marked as healthy unless customizing the healthchecks #855

Open
tanasegabriel opened this issue Jan 6, 2025 · 0 comments

Comments

@tanasegabriel
Copy link

Describe the bug
The default healthcheck runs on a 30s interval:

homer/Dockerfile

Lines 40 to 41 in d5921d9

HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT}/ || exit 1

This implies a ~30s wait in between starting the container and it being marked as healthy:

~ time docker compose up -d homer --wait
[+] Running 1/1
 ✔ Container homer  Healthy                                                                                       30.8s
docker compose up -d homer --wait  0.41s user 0.13s system 1% cpu 31.103 total

lighttpd boots blazingly fast; while this is not problematic when for example exposing ports, the likes of traefik will wait for the containers to be healthy before provisioning a router + service, etc. This results in a ~30s delay between starting the homer container and it being accessibly through traefik.

A quick fix for the compose file would be to add a healthcheck attribute as following:

    healthcheck:
      start_period: 10s
      start_interval: 1s

This significantly decreases the boot time, while preserving the 30s interval for healthecks once start_period has elapsed or the container has been marked as healthy:

~ time docker compose up -d homer --wait
[+] Running 1/1
 ✔ Container homer  Healthy                                                                                        1.9s
docker compose up -d homer --wait  0.34s user 0.07s system 18% cpu 2.199 total

It would be neat if these would be baked in the Dockerfile, to avoid other users experiencing this or having to define their custom healtheck.

Expected behavior
A clear and concise description of what you expected to happen.
Homer's container should be marked as healthy relatively soon after the lighttpd server has started.

Logs & errors
N/A

Screenshots
N/A

Configuration
If applicable, copy related homer yaml configuration here.
N/A

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

No branches or pull requests

1 participant