Fix case where both docker and podman are installed, but docker is not podman alias
This commit is contained in:
parent
55032f07af
commit
a9db750ea5
17
kernel.go
17
kernel.go
@ -97,8 +97,7 @@ func (cmd *KernelDockerRegenCmd) Run(kernelCmd *KernelCmd, g *Globals) (err erro
|
||||
}
|
||||
|
||||
args := []string{"build"}
|
||||
_, err = exec.Command("which", "podman").CombinedOutput()
|
||||
if err == nil {
|
||||
if dockerIsPodman() {
|
||||
args = append(args, "--squash-all")
|
||||
}
|
||||
args = append(args, "-t", d.ContainerName, imagePath)
|
||||
@ -353,8 +352,7 @@ func generateBaseDockerImage(registry string, commands []config.DockerCommand,
|
||||
}
|
||||
|
||||
args := []string{"build"}
|
||||
_, err = exec.Command("which", "podman").CombinedOutput()
|
||||
if err == nil {
|
||||
if dockerIsPodman() {
|
||||
args = append(args, "--squash-all")
|
||||
}
|
||||
args = append(args, "-t", sk.DockerName(), imagePath)
|
||||
@ -427,8 +425,7 @@ func dockerImageAppend(sk config.KernelMask, pkgname string) (err error) {
|
||||
}
|
||||
|
||||
args := []string{"build"}
|
||||
_, err = exec.Command("which", "podman").CombinedOutput()
|
||||
if err == nil {
|
||||
if dockerIsPodman() {
|
||||
args = append(args, "--squash-all")
|
||||
}
|
||||
args = append(args, "-t", sk.DockerName(), imagePath)
|
||||
@ -766,3 +763,11 @@ func generateKernels(km config.KernelMask, registry string,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func dockerIsPodman() bool {
|
||||
output, err := exec.Command("docker", "version").CombinedOutput()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return strings.Contains(string(output), "podman")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user