You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// checkDocker checks whether Docker is installed and the Docker daemon is running
39
-
funccheckDocker() error {
40
-
cmd:=exec.Command("docker", "--version")
41
-
iferr:=cmd.Run(); err!=nil {
42
-
returnfmt.Errorf("Docker appears not to be installed, so please visit their install page and try again once installed: https://www.docker.com/products/docker-desktop")
39
+
// detectContainerRuntime checks for a supported container runtime.
40
+
//
41
+
// Returns the detected runtime name.
42
+
funcdetectContainerRuntime() (string, error) {
43
+
// Default Docker, fallback Podman
44
+
runtimesToCheck:= []string{"docker", "podman"}
45
+
runtime:=""
46
+
for_, rt:=rangeruntimesToCheck {
47
+
cmd:=exec.Command(rt, "--version")
48
+
iferr:=cmd.Run(); err!=nil {
49
+
continue
50
+
}
51
+
runtime=rt
52
+
break
53
+
}
54
+
55
+
ifruntime=="" {
56
+
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, ", "))
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
+
}
43
76
}
44
77
45
-
cmd=exec.Command("docker", "info")
78
+
cmd:=exec.Command(runtime, "info")
46
79
iferr:=cmd.Run(); err!=nil {
47
-
returnfmt.Errorf("The Docker daemonappears not to be running. The command to start Docker depends on your operating system. For instructions, check the correct page under https://docs.docker.com/engine/install")
80
+
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)
returnfmt.Errorf("The \"otel-config\" directory is missing the \"%s\" file, so please consider removing and re-installing the otel plugin", composeFileName)
0 commit comments