oci hooks: print stdout/err on error
Maintainers usually reply within 1 day
@kolyshkin is already working on this.
Since Oct 21, 2026.
- #2379 by @Rajkaran-122 — closed without merging
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- c, linux
- Domain
- backend, operating-systems
Research direction
Start by reading the OCI hook execution and error handling paths, then inspect how the run.oci.hooks.stdout/stderr annotations currently route output. Add bounded buffering when those annotations are absent and include the failed hook's stdout and stderr in its error. Done means a failing hook's output appears in the error, while existing annotation behavior remains understood and covered.
Written by the indexing model from the issue text.
Description
crun recently enhanced the hook error message https://github.com/containers/crun/commit/9db5c4f2a9592907a9419561f582a8d87d447ad6 to print which hook, however for an end user they still do not know why the hook failed as the sdterr/out is not printed as part of the error.
Compared to runc which does seem to print the output:
runc create failed: unable to start container process: error during container init: error running createRuntime hook #0: exit status 2, stdout: stdout
, stderr: stderr
when using a basic failure example hook like this
#!/bin/bash
echo stdout
echo stderr >&2
exit 2
crun offers the run.oci.hooks.stdout/stderr annotations which do not help that much as a user needs to know to set them and check them and they would always print the output not just for the failed hook. In case of multiple hooks that may be a problem as a user could not know which output was written by which hook.
As such I would suggest if no run.oci.hooks.stdout/stderr is given the output should be buffered and added to the error message. If we are worried about the unlimted size we could limit the buffer to something like 8K which I think would be reasonable for most cases.
If this is generally acceptable I am willing to work on this and propose a PR.
- Dominant language
- C
- Stars
- 4.2k
- Forks
- 459
- Avg merge
- 23h 22m
- Merged PRs (30d)
- 91
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from containers/crun
-
cgroup-systemd: parse_cpu_max accepts malformed cpu.max values that the kernel reads differentlyOpen
Difficulty 3/5 1-2 days Newbie friendliness 68/100
containers/crun#2405 ·
Maintainers usually reply within 1 day
-
rshared bind mount loses the peer group of its source on kernel 6.12Possibly taken @kolyshkin claimed this 2 days ago. Open
containers/crun#2392 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 18/100
containers/crun#2333 · 3 comments ·
Maintainers usually reply within 1 day
-
crun fails creation when netDevices.name contains the supported %d templatePossibly taken @sairex53 claimed this 5 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 58/100
containers/crun#2331 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 22/100
containers/crun#2329 ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
libsdl-org/SDL#16577 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
halt_error adds a trailing newline for non-string input, contrary to the manualPossibly taken @Huang-404-Q claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MerginMaps/geodiff#272 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
open-quantum-safe/liboqs#2644 ·
Maintainers usually reply within 1 day