Skip to content

feat: show RootlessKit version in nerdctl version output#4971

Open
amarkdotdev wants to merge 1 commit into
containerd:mainfrom
amarkdotdev:feat/version-rootlesskit
Open

feat: show RootlessKit version in nerdctl version output#4971
amarkdotdev wants to merge 1 commit into
containerd:mainfrom
amarkdotdev:feat/version-rootlesskit

Conversation

@amarkdotdev

Copy link
Copy Markdown

Description

When running in rootless mode, nerdctl version now includes the RootlessKit version as a server component, matching how docker version displays it.

Before:

Server:
 containerd:
  Version:	v2.1.0
 runc:
  Version:	1.2.6

After (rootless mode):

Server:
 containerd:
  Version:	v2.1.0
 runc:
  Version:	1.2.6
 rootlesskit:
  Version:	2.3.1

The rootlesskit component is only shown when rootlessutil.IsRootless() is true. If rootlesskit is not found on PATH or its output cannot be parsed, a warning is logged and the component appears without a version string (same pattern as runc and buildctl).

Changes

  • pkg/infoutil/infoutil.go: added rootlessKitVersion() and parseRootlessKitVersion() functions, appended to ServerVersion.Components when rootless
  • pkg/infoutil/infoutil_test.go: added TestParseRootlessKitVersion covering normal output, dev versions, and invalid input

Testing

  • go build ./pkg/infoutil/... passes
  • go vet ./pkg/infoutil/... passes
  • go test ./pkg/infoutil/... passes (including the new parse test)

Fixes #4936

@amarkdotdev amarkdotdev force-pushed the feat/version-rootlesskit branch from 98761a9 to 02bf394 Compare June 18, 2026 14:25
Comment thread pkg/infoutil/infoutil.go Outdated
return &dockercompat.ComponentVersion{
Name: "rootlesskit",
Version: fields[2],
}, nil

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread pkg/infoutil/infoutil.go Outdated
// getMobySysInfo returns the moby system info for the given cgroup manager

func rootlessKitVersion() dockercompat.ComponentVersion {
stdout, err := exec.Command("rootlesskit", "--version").Output()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AkihiroSuda

Copy link
Copy Markdown
Member

There was already a PR #4937 from @MD-Mushfiqur123 , but it seems accidentally closed.

@amarkdotdev amarkdotdev force-pushed the feat/version-rootlesskit branch from 02bf394 to 16aaa26 Compare June 21, 2026 05:50
@amarkdotdev

Copy link
Copy Markdown
Author

Thanks @AkihiroSuda for the review. I've reworked the implementation per your feedback:

  • Replaced exec.Command("rootlesskit", "--version") with the RootlessKit API socket: rootlessutil.NewRootlessKitClient()client.Info(ctx)info.Version
  • ctx is propagated from ServerVersion(ctx, ...) into the new rootlessKitVersion(ctx) function
  • Removed the string-parsing code and its unit test (no longer needed with structured API response)

The function is still only called when rootlessutil.IsRootless() is true. If the API socket is unavailable or the Info call fails, it logs a warning and returns the component without a version (same graceful-degradation pattern as runcVersion).

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>
@amarkdotdev amarkdotdev force-pushed the feat/version-rootlesskit branch from 16aaa26 to dd8e035 Compare June 21, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nerdctl version should print the version of RootlessKit (in the same format as docker version)

2 participants