mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
do not allow sub second in healthcheck options in Dockerfile
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
91cffdbedb
commit
63811a82b6
1 changed files with 3 additions and 3 deletions
|
@ -475,7 +475,7 @@ func cmd(b *Builder, args []string, attributes map[string]bool, original string)
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseOptInterval(flag) is the duration of flag.Value, or 0 if
|
// parseOptInterval(flag) is the duration of flag.Value, or 0 if
|
||||||
// empty. An error is reported if the value is given and is not positive.
|
// empty. An error is reported if the value is given and less than 1 second.
|
||||||
func parseOptInterval(f *Flag) (time.Duration, error) {
|
func parseOptInterval(f *Flag) (time.Duration, error) {
|
||||||
s := f.Value
|
s := f.Value
|
||||||
if s == "" {
|
if s == "" {
|
||||||
|
@ -485,8 +485,8 @@ func parseOptInterval(f *Flag) (time.Duration, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
if d <= 0 {
|
if d < time.Duration(time.Second) {
|
||||||
return 0, fmt.Errorf("Interval %#v must be positive", f.name)
|
return 0, fmt.Errorf("Interval %#v cannot be less than 1 second", f.name)
|
||||||
}
|
}
|
||||||
return d, nil
|
return d, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue