Support start_period for healthcheck in Docker Compose

Signed-off-by: Li Yi <denverdino@gmail.com>
This commit is contained in:
Li Yi 2017-08-20 10:39:05 +08:00 committed by Li Yi
parent 21b5bbe411
commit 0abdad615f
5 changed files with 10 additions and 7 deletions

View File

@ -114,6 +114,7 @@ services:
interval: 10s interval: 10s
timeout: 1s timeout: 1s
retries: 5 retries: 5
start_period: 15s
# Any valid image reference - repo, tag, id, sha # Any valid image reference - repo, tag, id, sha
image: redis image: redis

View File

@ -756,10 +756,11 @@ func TestFullExample(t *testing.T) {
"somehost": "162.242.195.82", "somehost": "162.242.195.82",
}, },
HealthCheck: &types.HealthCheckConfig{ HealthCheck: &types.HealthCheckConfig{
Test: types.HealthCheckTest([]string{"CMD-SHELL", "echo \"hello world\""}), Test: types.HealthCheckTest([]string{"CMD-SHELL", "echo \"hello world\""}),
Interval: "10s", Interval: "10s",
Timeout: "1s", Timeout: "1s",
Retries: uint64Ptr(5), Retries: uint64Ptr(5),
StartPeriod: "15s",
}, },
Hostname: "foo", Hostname: "foo",
Image: "redis", Image: "redis",

File diff suppressed because one or more lines are too long

View File

@ -324,7 +324,8 @@
{"type": "array", "items": {"type": "string"}} {"type": "array", "items": {"type": "string"}}
] ]
}, },
"timeout": {"type": "string"} "timeout": {"type": "string"},
"start_period": {"type": "string"}
} }
}, },
"deployment": { "deployment": {

View File

@ -172,7 +172,7 @@ type HealthCheckConfig struct {
Timeout string Timeout string
Interval string Interval string
Retries *uint64 Retries *uint64
StartPeriod string StartPeriod string `mapstructure:"start_period"`
Disable bool Disable bool
} }