buildkit
buildkit copied to clipboard
[v0.10 backport] frontend: fix Healthcheck intervals and retries not accepting default values
- backport of https://github.com/moby/buildkit/pull/3092
- fixes https://github.com/docker/cli/issues/3771
frontend: allow 0 (default) value for healthcheck intervals
While these intervals have a minimum value when set:
// MinimumDuration puts a minimum on user configured duration.
// This is to prevent API error on time unit. For example, API may
// set 3 as healthcheck interval with intention of 3 seconds, but
// Docker interprets it as 3 nanoseconds.
const MinimumDuration = 1 * time.Millisecond
It should be possible to set them to 0 (which is teh default). This patch
updates the Dockerfile parser to use the same logic as the docker daemon uses;
if healthConfig.StartPeriod != 0 && healthConfig.StartPeriod < containertypes.MinimumDuration {
return errors.Errorf("StartPeriod in Healthcheck cannot be less than %s", containertypes.MinimumDuration)
}
frontend: allow 0 (default) value for healthcheck retries
0 is the default value, so should be ok to explicitly use.
@crazy-max @tonistiigi opened this backport; I think the docker/dockerfile releases are done from this branch, correct?
I think the
docker/dockerfilereleases are done from this branch, correct?
Yes
As this isn't a regression and seems to have been the behavior since the creation of healtchecks I doubt if we should backport it.