Skip to content

Commit b2cfa11

Browse files
committed
fix: add error message for podman compose providers
Signed-off-by: Andrew Steurer <94206073+asteurer@users.noreply.github.com>
1 parent dc077a6 commit b2cfa11

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

cmd/root.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,25 @@ func detectContainerRuntime() (string, error) {
5656
return "", fmt.Errorf("Unable to detect container runtime.\nPlease ensure at least one of the following is installed and in the PATH: %s\n", strings.Join(runtimesToCheck, ", "))
5757
}
5858

59+
if runtime == "podman" {
60+
// Podman doesn't auto-install a compose provider
61+
composeProvidersToCheck := []string{"podman-compose", "docker-compose"}
62+
composeProvider := ""
63+
for _, rt := range composeProvidersToCheck {
64+
cmd := exec.Command(rt, "--version")
65+
if err := cmd.Run(); err != nil {
66+
continue
67+
}
68+
69+
composeProvider = rt
70+
break
71+
}
72+
73+
if composeProvider == "" {
74+
return "", fmt.Errorf("Unable to detect compose provider.\n Please ensure at least one of the following is installed and in the PATH: %s\n", strings.Join(composeProvidersToCheck, ", "))
75+
}
76+
}
77+
5978
cmd := exec.Command(runtime, "info")
6079
if err := cmd.Run(); err != nil {
6180
return "", fmt.Errorf("The daemon/virtual machine for %[1]s appears not to be running. Please check the documentation for %[1]s for more information.", runtime)

0 commit comments

Comments
 (0)