From 644aae301aa1dc81ac1a1afb18ab1705dfebe47e Mon Sep 17 00:00:00 2001 From: Christian Jantz Date: Mon, 14 May 2018 18:41:01 +0200 Subject: [PATCH 1/3] added healthcheck to config struct and healthcheck struct --- v1/config.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/v1/config.go b/v1/config.go index 17fa0d20b..d1d809d91 100644 --- a/v1/config.go +++ b/v1/config.go @@ -64,6 +64,27 @@ type RootFS struct { DiffIDs []Hash `json:"diff_ids"` } +// HealthConfig holds configuration settings for the HEALTHCHECK feature. +type HealthConfig struct { + // Test is the test to perform to check that the container is healthy. + // An empty slice means to inherit the default. + // The options are: + // {} : inherit healthcheck + // {"NONE"} : disable healthcheck + // {"CMD", args...} : exec arguments directly + // {"CMD-SHELL", command} : run command with system's default shell + Test []string `json:",omitempty"` + + // Zero means to inherit. Durations are expressed as integer nanoseconds. + Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks. + Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung. + StartPeriod time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down. + + // Retries is the number of consecutive failures needed to consider a container as unhealthy. + // Zero means inherit. + Retries int `json:",omitempty"` +} + // Config is a submessage of the config file described as: // The execution parameters which SHOULD be used as a base when running // a container using the image. @@ -77,6 +98,7 @@ type Config struct { AttachStdin bool AttachStdout bool Cmd []string + Healthcheck *HealthConfig Domainname string Entrypoint []string Env []string From 94957d14f0cae5219de84493db4661f7b47cafcd Mon Sep 17 00:00:00 2001 From: Christian Jantz Date: Mon, 14 May 2018 19:32:26 +0200 Subject: [PATCH 2/3] added test tag to HealthConfig Test --- v1/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v1/config.go b/v1/config.go index d1d809d91..81884a64c 100644 --- a/v1/config.go +++ b/v1/config.go @@ -73,7 +73,7 @@ type HealthConfig struct { // {"NONE"} : disable healthcheck // {"CMD", args...} : exec arguments directly // {"CMD-SHELL", command} : run command with system's default shell - Test []string `json:",omitempty"` + Test []string `json:"test,omitempty"` // Zero means to inherit. Durations are expressed as integer nanoseconds. Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks. From a280ed04b1c938bcedc650392f29165aa3bf4396 Mon Sep 17 00:00:00 2001 From: Christian Jantz Date: Mon, 14 May 2018 20:53:25 +0200 Subject: [PATCH 3/3] Revert "added test tag to HealthConfig Test" This reverts commit 94957d14f0cae5219de84493db4661f7b47cafcd. --- v1/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v1/config.go b/v1/config.go index 81884a64c..d1d809d91 100644 --- a/v1/config.go +++ b/v1/config.go @@ -73,7 +73,7 @@ type HealthConfig struct { // {"NONE"} : disable healthcheck // {"CMD", args...} : exec arguments directly // {"CMD-SHELL", command} : run command with system's default shell - Test []string `json:"test,omitempty"` + Test []string `json:",omitempty"` // Zero means to inherit. Durations are expressed as integer nanoseconds. Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks.