From 63811a82b67528494f711086547580e7c40aaa93 Mon Sep 17 00:00:00 2001 From: allencloud Date: Mon, 20 Feb 2017 15:47:34 +0800 Subject: [PATCH] do not allow sub second in healthcheck options in Dockerfile Signed-off-by: allencloud --- builder/dockerfile/dispatchers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builder/dockerfile/dispatchers.go b/builder/dockerfile/dispatchers.go index 2756fe8c9d..09fd602545 100644 --- a/builder/dockerfile/dispatchers.go +++ b/builder/dockerfile/dispatchers.go @@ -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 -// 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 == "" { @@ -485,8 +485,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 }