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
fix(shim): support non-CRI callers (BuildKit, ctr) in containerd shim
Fix two issues that prevent gVisor containers from working when
created through containerd's direct API (non-CRI), such as BuildKit's
containerd worker or `ctr run`:
1. Sandbox detection: SpecContainerType returns ContainerTypeUnspecified
for non-CRI callers that don't set the container type annotation.
Previously this resulted in p.Sandbox=false, which skipped passing
IO file descriptors to runsc create. Without IO, container processes
receive SIGPIPE on stdout/stderr writes and exit with code 128.
Fix: treat ContainerTypeUnspecified as sandbox, since non-CRI
containers are always root/sandbox containers.
2. Wait error handling: For short-lived containers, the sandbox may
exit before `runsc wait` retrieves the exit status, producing
"sandbox no longer running and its exit status is unavailable".
This error was treated as fatal (setting internalErrorCode=128)
even when the container exited successfully (status=0).
Fix: extract adjustWaitStatus() and when status is 0, log the
error as a warning but preserve the exit status.
Includes unit tests for both fixes:
- TestSandboxDetection: 7 cases covering all container type variants
- TestAdjustWaitStatus: 7 cases covering all status/error combinations
Fixes#12198
Tested: BuildKit containerd worker with gVisor on GCE e2-standard-4,
containerd v1.7.29, runsc release-20260330.0. Six consecutive RUN
steps (echo, ls, cat, apk add curl) all pass with exit code 0.
0 commit comments