From 6ecdd6726243ba15ea56f4d8193d298f27f439ac Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Fri, 9 Oct 2026 01:37:57 +1100 Subject: [PATCH] fix(container): reap orphaned processes in Kit containers --- internal/container/kit.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/container/kit.go b/internal/container/kit.go index 22d788b5d..83c7e2736 100644 --- a/internal/container/kit.go +++ b/internal/container/kit.go @@ -49,6 +49,10 @@ func StartKit(ctx context.Context, cli *client.Client, s KitSpec) (string, error } mounts = append(mounts, mount.Mount{Type: mount.TypeVolume, Source: v.Name, Target: v.Path}) } + // Docker's own init becomes PID 1 and reaps orphans. The worker is PID 1 + // otherwise, and a detached hook that forks and exits leaves zombies the + // worker never waits on, until the container's PID table is exhausted. + hostInit := true created, err := cli.ContainerCreate(ctx, client.ContainerCreateOptions{ Name: s.Name, Config: &container.Config{ @@ -64,6 +68,7 @@ func StartKit(ctx context.Context, cli *client.Client, s KitSpec) (string, error NetworkMode: container.NetworkMode(s.Network), Binds: s.Binds, Mounts: mounts, + Init: &hostInit, }, }) if err != nil {