mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #39389 from thaJeztah/fix_LCOW_healthchecks
LCOW: fix using wrong shell for healthchecks
This commit is contained in:
commit
4abac69dc6
1 changed files with 7 additions and 5 deletions
|
@ -10,7 +10,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
containertypes "github.com/docker/docker/api/types/container"
|
|
||||||
"github.com/docker/docker/api/types/strslice"
|
"github.com/docker/docker/api/types/strslice"
|
||||||
"github.com/docker/docker/container"
|
"github.com/docker/docker/container"
|
||||||
"github.com/docker/docker/daemon/exec"
|
"github.com/docker/docker/daemon/exec"
|
||||||
|
@ -65,7 +64,7 @@ type cmdProbe struct {
|
||||||
func (p *cmdProbe) run(ctx context.Context, d *Daemon, cntr *container.Container) (*types.HealthcheckResult, error) {
|
func (p *cmdProbe) run(ctx context.Context, d *Daemon, cntr *container.Container) (*types.HealthcheckResult, error) {
|
||||||
cmdSlice := strslice.StrSlice(cntr.Config.Healthcheck.Test)[1:]
|
cmdSlice := strslice.StrSlice(cntr.Config.Healthcheck.Test)[1:]
|
||||||
if p.shell {
|
if p.shell {
|
||||||
cmdSlice = append(getShell(cntr.Config), cmdSlice...)
|
cmdSlice = append(getShell(cntr), cmdSlice...)
|
||||||
}
|
}
|
||||||
entrypoint, args := d.getEntrypointAndArgs(strslice.StrSlice{}, cmdSlice)
|
entrypoint, args := d.getEntrypointAndArgs(strslice.StrSlice{}, cmdSlice)
|
||||||
execConfig := exec.NewConfig()
|
execConfig := exec.NewConfig()
|
||||||
|
@ -376,12 +375,15 @@ func min(x, y int) int {
|
||||||
return y
|
return y
|
||||||
}
|
}
|
||||||
|
|
||||||
func getShell(config *containertypes.Config) []string {
|
func getShell(cntr *container.Container) []string {
|
||||||
if len(config.Shell) != 0 {
|
if len(cntr.Config.Shell) != 0 {
|
||||||
return config.Shell
|
return cntr.Config.Shell
|
||||||
}
|
}
|
||||||
if runtime.GOOS != "windows" {
|
if runtime.GOOS != "windows" {
|
||||||
return []string{"/bin/sh", "-c"}
|
return []string{"/bin/sh", "-c"}
|
||||||
}
|
}
|
||||||
|
if cntr.OS != runtime.GOOS {
|
||||||
|
return []string{"/bin/sh", "-c"}
|
||||||
|
}
|
||||||
return []string{"cmd", "/S", "/C"}
|
return []string{"cmd", "/S", "/C"}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue