From 8e3ca1f8c060643da66e099f5d89e3eb334fdbdf Mon Sep 17 00:00:00 2001 From: Timo Pagel Date: Thu, 14 Jan 2021 14:32:32 +0100 Subject: [PATCH] Fix: Distroless containers do not have a path By using distroless containers, we try to remove as much as possible. Therefore, no bash/sh/$PATH is there. To be able to run distroless-image in the pipeline, the absolute path would be helpful. --- .../jenkinsci/plugins/docker/workflow/WithContainerStep.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java b/src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java index ebbfd68a3..2eb44331b 100644 --- a/src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java +++ b/src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java @@ -194,7 +194,7 @@ public Execution() { volumes.put(tmp, tmp); } - String command = launcher.isUnix() ? "cat" : "cmd.exe"; + String command = launcher.isUnix() ? "/bin/cat" : "cmd.exe"; container = dockerClient.run(env, step.image, step.args, ws, volumes, volumesFromContainers, envReduced, dockerClient.whoAmI(), /* expected to hang until killed */ command); final List ps = dockerClient.listProcess(env, container); if (!ps.contains(command)) {