Skip to content

Commit

Permalink
healthcheck: reject empty commands
Browse files Browse the repository at this point in the history
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 <[email protected]>
stefanb2 committed Jul 16, 2019

Verified

This commit was signed with the committer’s verified signature. The key has expired.
tzemanovic Tomas Zemanovic
1 parent 5caf218 commit 5ed2de1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libpod/healthcheck.go
Original file line number Diff line number Diff line change
@@ -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,

0 comments on commit 5ed2de1

Please sign in to comment.