Skip to content

Commit 18d98b1

Browse files
Run containers with --init by default to avoid leaking zombie processes.
People running containers manually usually run with pid 1 being a $SHELL, in which case waiting for child termination is something implemented already as it's the core job of a $SHELL. However with this jenkins plugin the command run is usually "cat" on Linux, which doesn't wait at all for children. To have in jenkins a situation a bit like during interactive container experience, start containers with --init so zombie processes are correctly reaped.
1 parent 7d5f6a0 commit 18d98b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public DockerClient(@NonNull Launcher launcher, @CheckForNull Node node, @CheckF
116116
public String run(@NonNull EnvVars launchEnv, @NonNull String image, @CheckForNull String args, @CheckForNull String workdir, @NonNull Map<String, String> volumes, @NonNull Collection<String> volumesFromContainers, @NonNull EnvVars containerEnv, @NonNull String user, @NonNull String... command) throws IOException, InterruptedException {
117117
ArgumentListBuilder argb = new ArgumentListBuilder();
118118

119-
argb.add("run", "-t", "-d");
119+
argb.add("run", "-t", "-d", "--init");
120120

121121
// Username might be empty because we are running on Windows
122122
if (StringUtils.isNotEmpty(user)) {

0 commit comments

Comments
 (0)