Skip to content

Commit

Permalink
Merge pull request #32138 from gsmet/container-runtime-executable
Browse files Browse the repository at this point in the history
Provide proper Docker executable name on Windows
  • Loading branch information
gsmet authored Mar 27, 2023
2 parents dc0d04b + b8f5fce commit 0c82eef
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions core/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.common</groupId>
<artifactId>smallrye-common-os</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-ide-launcher</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.eclipse.microprofile.config.ConfigProvider;
import org.jboss.logging.Logger;

import io.smallrye.common.os.OS;
import io.smallrye.config.SmallRyeConfig;

public final class ContainerRuntimeUtil {
Expand Down Expand Up @@ -192,18 +193,24 @@ private static boolean getRootlessStateFor(ContainerRuntime containerRuntime) {
* Supported Container runtimes
*/
public enum ContainerRuntime {
DOCKER,
PODMAN,
UNAVAILABLE;
DOCKER("docker" + (OS.current() == OS.WINDOWS ? ".exe" : "")),
PODMAN("podman" + (OS.current() == OS.WINDOWS ? ".exe" : "")),
UNAVAILABLE(null);

private Boolean rootless;

private String executableName;

ContainerRuntime(String executableName) {
this.executableName = executableName;
}

public String getExecutableName() {
if (this == UNAVAILABLE) {
throw new IllegalStateException("Cannot get an executable name when no container runtime is available");
}

return this.name().toLowerCase();
return executableName;
}

public boolean isRootless() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
#Wed Jan 23 12:03:29 AEDT 2019
0=java
1=javax
2=org
3=com
2=jakarta
3=org
4=com

0 comments on commit 0c82eef

Please sign in to comment.