mirror of
https://github.com/containers/podman.git
synced 2025-12-03 03:39:44 +08:00
healthcheck: reject empty commands
An image with "HEALTHCHECK CMD ['']" is valid but as there is no command defined the healthcheck will fail. Reject such a configuration. Fixes #3507 Signed-off-by: Stefan Becker <chemobejk@gmail.com>
This commit is contained in:
@@ -123,6 +123,9 @@ func (c *Container) runHealthCheck() (HealthCheckStatus, error) {
|
||||
// command supplied on command line - pass as-is
|
||||
newCommand = hcCommand
|
||||
}
|
||||
if len(newCommand) < 1 || newCommand[0] == "" {
|
||||
return HealthCheckNotDefined, errors.Errorf("container %s has no defined healthcheck", c.ID())
|
||||
}
|
||||
captureBuffer := bufio.NewWriter(&capture)
|
||||
hcw := hcWriteCloser{
|
||||
captureBuffer,
|
||||
|
||||
Reference in New Issue
Block a user