1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #31177 from allencloud/donot-allow-subsecond-in-dockerfile-healthcheck

do not allow sub second in healthcheck options in Dockerfile
This commit is contained in:
Sebastiaan van Stijn 2017-03-08 15:18:09 +01:00 committed by GitHub
commit fb1890fb95

View file

@ -447,7 +447,7 @@ func cmd(b *Builder, args []string, attributes map[string]bool, original string)
}
// 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) {
s := f.Value
if s == "" {
@ -457,8 +457,8 @@ func parseOptInterval(f *Flag) (time.Duration, error) {
if err != nil {
return 0, err
}
if d <= 0 {
return 0, fmt.Errorf("Interval %#v must be positive", f.name)
if d < time.Duration(time.Second) {
return 0, fmt.Errorf("Interval %#v cannot be less than 1 second", f.name)
}
return d, nil
}