Browse code

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

do not allow sub second in healthcheck options in Dockerfile

Sebastiaan van Stijn authored on 2017/03/08 23:18:09
Showing 1 changed files
... ...
@@ -447,7 +447,7 @@ func cmd(b *Builder, args []string, attributes map[string]bool, original string)
447 447
 }
448 448
 
449 449
 // parseOptInterval(flag) is the duration of flag.Value, or 0 if
450
-// empty. An error is reported if the value is given and is not positive.
450
+// empty. An error is reported if the value is given and less than 1 second.
451 451
 func parseOptInterval(f *Flag) (time.Duration, error) {
452 452
 	s := f.Value
453 453
 	if s == "" {
... ...
@@ -457,8 +457,8 @@ func parseOptInterval(f *Flag) (time.Duration, error) {
457 457
 	if err != nil {
458 458
 		return 0, err
459 459
 	}
460
-	if d <= 0 {
461
-		return 0, fmt.Errorf("Interval %#v must be positive", f.name)
460
+	if d < time.Duration(time.Second) {
461
+		return 0, fmt.Errorf("Interval %#v cannot be less than 1 second", f.name)
462 462
 	}
463 463
 	return d, nil
464 464
 }