daemon/nri: populate Container.Args with full resolved process argv - #53423
Open
bbartels wants to merge 1 commit into
Open
daemon/nri: populate Container.Args with full resolved process argv#53423bbartels wants to merge 1 commit into
bbartels wants to merge 1 commit into
Conversation
Member
|
Looks like the PR contains commits unrelated to this change (and various merge commits); can you clean that up? |
Build NRI container metadata from the daemon's resolved process path and arguments so plugins observe the same argv used by the OCI runtime spec. Add coverage for entrypoint and command combinations and verify that the exported slice does not alias container state. Signed-off-by: Benjamin Bartels <benjamin@bartels.dev>
bbartels
force-pushed
the
nri-container-metadata-fix
branch
from
August 20, 2026 20:21
5877dfe to
3bf1d6e
Compare
Author
|
Cleaned up and force-pushed the branch as a single signed-off commit based on current |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NRI plugins receive container metadata whose
Argsfield was populated fromConfig.Cmdonly, omitting the entrypoint/executable. Plugins therefore couldn't determine the actual launched process, and the metadata diverged from the argv Moby places in the OCI runtime spec:Changes
daemon/internal/nri/nri.go—containerToNRInow buildsArgsfrom the container's resolved launch fields:ctr.Path/ctr.Argsare resolved from Entrypoint/Cmd bydaemon.newContainer(getEntrypointAndArgs) beforedaemon.nri.CreateContainerruns, so they are always populated at conversion time.daemon/oci_linux.go,daemon/oci_windows.go:append([]string{c.Path}, c.Args...)).daemon/internal/nri/nri_test.go(new) — unit tests forcontainerToNRIcovering:["echo"]+["hello"]→["echo", "hello"])["/usr/bin/tool", "--mode"]+["input"])argv[0])Backward compatibility
Behavior change for plugins that assumed
Args[0]was the first DockerCmdargument —Argsnow includes the executable at index zero. Docker's NRI support is experimental; this aligns the metadata with the launched process.ContainerAdjustment.Argshandling and CLI Entrypoint/Cmd semantics are untouched.Release notes (optional)
Created with: GitHub Copilot Task Agent