-
-
Notifications
You must be signed in to change notification settings - Fork 165
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
Docker: Specify health check start period and interval #439
Conversation
570a766
to
fed21bc
Compare
Thanks. Unfortunately there are compatibility issues with From memory those timeout / delay options in Docker are quite a mess and very badly documented. I'm fairly sure that this is the main option you're after here (ie: the one that would actually make a real difference), so my question is, would an alternative (without |
The default start interval, if unspecified, is 5s which is better than nothing. In order for it to kick in, start period needs to be set though, as start period does not have a good default. So start period let's say 5s or 10s without start interval would be ok and yield an improvement -- in practice decreasing reaching healthy state from the current 15s to 5s. So, that would be e.g. HEALTHCHECK --interval=15s --start-period=10s CMD /mailpit readyz 5s is still a pretty bad developer experience, but an out of the box improvement anyway. |
fed21bc
to
31d9153
Compare
Dropped Should that be a comment in the Dockerfile instead/in addition? For example # --start-interval would be nice, but is reportedly not good compatibilitywise.
# --start-period makes the default start interval (typically 5s) kick in where available. |
31d9153
to
394af7d
Compare
Thanks for the update. I gave this a test (locally), and it still took exactly 15 seconds before a I then revisited the So the way I see it I have two choices:
I think I'll go for option 1 (if you don't mind changing it back.... sorry to hassle you!) - with the condition that I may have to revert the change if I start getting bug reports. So if you don't mind reverting your change I will then merge that change. Thank you. |
I tested it yesterday too, and it (adding just the start period) made the described difference to me. I just retested, and it still does. Reproducer: $ grep HEALTHCHECK Dockerfile
HEALTHCHECK --interval=15s --start-period=10s CMD /mailpit readyz
$ docker build -t meh .
[...]
$ docker run --rm --name mailpit-test -d meh; sleep 4; for i in {1..3}; do docker ps | grep mailpit-test; sleep 1; done
8f06168b525ab0ee2b30b5a9055a6177a1063a9db103a40790106a1f46277cd1
8f06168b525a meh "/mailpit" 4 seconds ago Up 4 seconds (health: starting) 1025/tcp, 1110/tcp, 8025/tcp mailpit-test
8f06168b525a meh "/mailpit" 5 seconds ago Up 5 seconds (health: starting) 1025/tcp, 1110/tcp, 8025/tcp mailpit-test
8f06168b525a meh "/mailpit" 6 seconds ago Up 6 seconds (healthy) 1025/tcp, 1110/tcp, 8025/tcp mailpit-test My docker is, on Ubuntu 24.10:
But I'm happy to pretend I didn't say any of the above and put --start-interval=1s back there :) |
To reach healthy state faster at startup.
394af7d
to
decd239
Compare
Done in decd239 |
Thank you. It goes to show the differences between Docker versions... I'm using Ubuntu 24.10 too, but using the default Anyway, this has been merged, and will be included in the next release (I try not release too often) ❤️ |
To reach healthy state faster at startup.
https://docs.docker.com/reference/dockerfile/#healthcheck