buildkit icon indicating copy to clipboard operation
buildkit copied to clipboard

[v0.10 backport] frontend: fix Healthcheck intervals and retries not accepting default values

Open thaJeztah opened this issue 3 years ago • 3 comments

  • 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.

thaJeztah avatar Sep 09 '22 10:09 thaJeztah

@crazy-max @tonistiigi opened this backport; I think the docker/dockerfile releases are done from this branch, correct?

thaJeztah avatar Sep 09 '22 10:09 thaJeztah

I think the docker/dockerfile releases are done from this branch, correct?

Yes

crazy-max avatar Sep 09 '22 10:09 crazy-max

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.

tonistiigi avatar Sep 12 '22 04:09 tonistiigi