feat: show RootlessKit version in nerdctl version output#4971
Open
amarkdotdev wants to merge 1 commit into
Open
feat: show RootlessKit version in nerdctl version output#4971amarkdotdev wants to merge 1 commit into
amarkdotdev wants to merge 1 commit into
Conversation
98761a9 to
02bf394
Compare
AkihiroSuda
reviewed
Jun 18, 2026
| return &dockercompat.ComponentVersion{ | ||
| Name: "rootlesskit", | ||
| Version: fields[2], | ||
| }, nil |
AkihiroSuda
reviewed
Jun 18, 2026
| // getMobySysInfo returns the moby system info for the given cgroup manager | ||
|
|
||
| func rootlessKitVersion() dockercompat.ComponentVersion { | ||
| stdout, err := exec.Command("rootlesskit", "--version").Output() |
Member
|
There was already a PR #4937 from @MD-Mushfiqur123 , but it seems accidentally closed. |
02bf394 to
16aaa26
Compare
Author
|
Thanks @AkihiroSuda for the review. I've reworked the implementation per your feedback:
The function is still only called when Regarding PR #4937 from @MD-Mushfiqur123 — I saw it was accidentally closed. Happy to step aside if they'd like to re-open theirs, or keep this one going if that's simpler for you. |
When running in rootless mode, nerdctl version now includes the RootlessKit version as a server component, matching the format used by docker version. The version is retrieved via the RootlessKit API socket (rootlessutil.NewRootlessKitClient + Info(ctx)) rather than shelling out to rootlesskit --version, which is more robust and avoids PATH issues. The version is only shown when rootless mode is active (i.e. when rootlessutil.IsRootless() is true). If the API socket is unavailable or the Info call fails, a warning is logged and the component is shown without a version string. Fixes containerd#4936 Signed-off-by: Aaron Mark <64331623+amarkdotdev@users.noreply.github.com>
16aaa26 to
dd8e035
Compare
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.
Description
When running in rootless mode,
nerdctl versionnow includes the RootlessKit version as a server component, matching howdocker versiondisplays it.Before:
After (rootless mode):
The
rootlesskitcomponent is only shown whenrootlessutil.IsRootless()is true. Ifrootlesskitis not found on PATH or its output cannot be parsed, a warning is logged and the component appears without a version string (same pattern asruncandbuildctl).Changes
pkg/infoutil/infoutil.go: addedrootlessKitVersion()andparseRootlessKitVersion()functions, appended toServerVersion.Componentswhen rootlesspkg/infoutil/infoutil_test.go: addedTestParseRootlessKitVersioncovering normal output, dev versions, and invalid inputTesting
go build ./pkg/infoutil/...passesgo vet ./pkg/infoutil/...passesgo test ./pkg/infoutil/...passes (including the new parse test)Fixes #4936