Signed-off-by: Dong Chen <dongluo.chen@docker.com>
| ... | ... |
@@ -230,10 +230,10 @@ func addFlags(flags *pflag.FlagSet) *containerOptions {
|
| 230 | 230 |
|
| 231 | 231 |
// Health-checking |
| 232 | 232 |
flags.StringVar(&copts.healthCmd, "health-cmd", "", "Command to run to check health") |
| 233 |
- flags.DurationVar(&copts.healthInterval, "health-interval", 0, "Time between running the check (ns|us|ms|s|m|h) (default 0s)") |
|
| 233 |
+ flags.DurationVar(&copts.healthInterval, "health-interval", 0, "Time between running the check (ms|s|m|h) (default 0s)") |
|
| 234 | 234 |
flags.IntVar(&copts.healthRetries, "health-retries", 0, "Consecutive failures needed to report unhealthy") |
| 235 |
- flags.DurationVar(&copts.healthTimeout, "health-timeout", 0, "Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)") |
|
| 236 |
- flags.DurationVar(&copts.healthStartPeriod, "health-start-period", 0, "Start period for the container to initialize before starting health-retries countdown (ns|us|ms|s|m|h) (default 0s)") |
|
| 235 |
+ flags.DurationVar(&copts.healthTimeout, "health-timeout", 0, "Maximum time to allow one check to run (ms|s|m|h) (default 0s)") |
|
| 236 |
+ flags.DurationVar(&copts.healthStartPeriod, "health-start-period", 0, "Start period for the container to initialize before starting health-retries countdown (ms|s|m|h) (default 0s)") |
|
| 237 | 237 |
flags.SetAnnotation("health-start-period", "version", []string{"1.29"})
|
| 238 | 238 |
flags.BoolVar(&copts.noHealthcheck, "no-healthcheck", false, "Disable any container-specified HEALTHCHECK") |
| 239 | 239 |
|
| ... | ... |
@@ -802,13 +802,13 @@ func addServiceFlags(flags *pflag.FlagSet, opts *serviceOptions, defaultFlagValu |
| 802 | 802 |
|
| 803 | 803 |
flags.StringVar(&opts.healthcheck.cmd, flagHealthCmd, "", "Command to run to check health") |
| 804 | 804 |
flags.SetAnnotation(flagHealthCmd, "version", []string{"1.25"})
|
| 805 |
- flags.Var(&opts.healthcheck.interval, flagHealthInterval, "Time between running the check (ns|us|ms|s|m|h)") |
|
| 805 |
+ flags.Var(&opts.healthcheck.interval, flagHealthInterval, "Time between running the check (ms|s|m|h)") |
|
| 806 | 806 |
flags.SetAnnotation(flagHealthInterval, "version", []string{"1.25"})
|
| 807 |
- flags.Var(&opts.healthcheck.timeout, flagHealthTimeout, "Maximum time to allow one check to run (ns|us|ms|s|m|h)") |
|
| 807 |
+ flags.Var(&opts.healthcheck.timeout, flagHealthTimeout, "Maximum time to allow one check to run (ms|s|m|h)") |
|
| 808 | 808 |
flags.SetAnnotation(flagHealthTimeout, "version", []string{"1.25"})
|
| 809 | 809 |
flags.IntVar(&opts.healthcheck.retries, flagHealthRetries, 0, "Consecutive failures needed to report unhealthy") |
| 810 | 810 |
flags.SetAnnotation(flagHealthRetries, "version", []string{"1.25"})
|
| 811 |
- flags.Var(&opts.healthcheck.startPeriod, flagHealthStartPeriod, "Start period for the container to initialize before counting retries towards unstable (ns|us|ms|s|m|h)") |
|
| 811 |
+ flags.Var(&opts.healthcheck.startPeriod, flagHealthStartPeriod, "Start period for the container to initialize before counting retries towards unstable (ms|s|m|h)") |
|
| 812 | 812 |
flags.SetAnnotation(flagHealthStartPeriod, "version", []string{"1.29"})
|
| 813 | 813 |
flags.BoolVar(&opts.healthcheck.noHealthcheck, flagNoHealthcheck, false, "Disable any container-specified HEALTHCHECK") |
| 814 | 814 |
flags.SetAnnotation(flagNoHealthcheck, "version", []string{"1.25"})
|
| ... | ... |
@@ -244,20 +244,20 @@ func (daemon *Daemon) verifyContainerSettings(hostConfig *containertypes.HostCon |
| 244 | 244 |
|
| 245 | 245 |
// Validate the healthcheck params of Config |
| 246 | 246 |
if config.Healthcheck != nil {
|
| 247 |
- if config.Healthcheck.Interval != 0 && config.Healthcheck.Interval < time.Second {
|
|
| 248 |
- return nil, fmt.Errorf("Interval in Healthcheck cannot be less than one second")
|
|
| 247 |
+ if config.Healthcheck.Interval != 0 && config.Healthcheck.Interval < time.Millisecond {
|
|
| 248 |
+ return nil, fmt.Errorf("Interval in Healthcheck cannot be less than one millisecond")
|
|
| 249 | 249 |
} |
| 250 | 250 |
|
| 251 |
- if config.Healthcheck.Timeout != 0 && config.Healthcheck.Timeout < time.Second {
|
|
| 252 |
- return nil, fmt.Errorf("Timeout in Healthcheck cannot be less than one second")
|
|
| 251 |
+ if config.Healthcheck.Timeout != 0 && config.Healthcheck.Timeout < time.Millisecond {
|
|
| 252 |
+ return nil, fmt.Errorf("Timeout in Healthcheck cannot be less than one millisecond")
|
|
| 253 | 253 |
} |
| 254 | 254 |
|
| 255 | 255 |
if config.Healthcheck.Retries < 0 {
|
| 256 | 256 |
return nil, fmt.Errorf("Retries in Healthcheck cannot be negative")
|
| 257 | 257 |
} |
| 258 | 258 |
|
| 259 |
- if config.Healthcheck.StartPeriod < 0 {
|
|
| 260 |
- return nil, fmt.Errorf("StartPeriod in Healthcheck cannot be negative")
|
|
| 259 |
+ if config.Healthcheck.StartPeriod != 0 && config.Healthcheck.StartPeriod < time.Millisecond {
|
|
| 260 |
+ return nil, fmt.Errorf("StartPeriod in Healthcheck cannot be less than one millisecond")
|
|
| 261 | 261 |
} |
| 262 | 262 |
} |
| 263 | 263 |
} |
| ... | ... |
@@ -33,10 +33,10 @@ Options: |
| 33 | 33 |
--env-file list Read in a file of environment variables |
| 34 | 34 |
--group list Set one or more supplementary user groups for the container |
| 35 | 35 |
--health-cmd string Command to run to check health |
| 36 |
- --health-interval duration Time between running the check (ns|us|ms|s|m|h) |
|
| 36 |
+ --health-interval duration Time between running the check (ms|s|m|h) |
|
| 37 | 37 |
--health-retries int Consecutive failures needed to report unhealthy |
| 38 |
- --health-start-period duration Start period for the container to initialize before counting retries towards unstable (ns|us|ms|s|m|h) |
|
| 39 |
- --health-timeout duration Maximum time to allow one check to run (ns|us|ms|s|m|h) |
|
| 38 |
+ --health-start-period duration Start period for the container to initialize before counting retries towards unstable (ms|s|m|h) |
|
| 39 |
+ --health-timeout duration Maximum time to allow one check to run (ms|s|m|h) |
|
| 40 | 40 |
--help Print usage |
| 41 | 41 |
--host list Set one or more custom host-to-IP mappings (host:ip) |
| 42 | 42 |
--hostname string Container hostname |
| ... | ... |
@@ -41,10 +41,10 @@ Options: |
| 41 | 41 |
--group-add list Add an additional supplementary user group to the container |
| 42 | 42 |
--group-rm list Remove a previously added supplementary user group from the container |
| 43 | 43 |
--health-cmd string Command to run to check health |
| 44 |
- --health-interval duration Time between running the check (ns|us|ms|s|m|h) |
|
| 44 |
+ --health-interval duration Time between running the check (ms|s|m|h) |
|
| 45 | 45 |
--health-retries int Consecutive failures needed to report unhealthy |
| 46 |
- --health-start-period duration Start period for the container to initialize before counting retries towards unstable (ns|us|ms|s|m|h) |
|
| 47 |
- --health-timeout duration Maximum time to allow one check to run (ns|us|ms|s|m|h) |
|
| 46 |
+ --health-start-period duration Start period for the container to initialize before counting retries towards unstable (ms|s|m|h) |
|
| 47 |
+ --health-timeout duration Maximum time to allow one check to run (ms|s|m|h) |
|
| 48 | 48 |
--help Print usage |
| 49 | 49 |
--host-add list Add or update a custom host-to-IP mapping (host:ip) |
| 50 | 50 |
--host-rm list Remove a custom host-to-IP mapping (host:ip) |