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

When running in rootless mode, nerdctl version now includes the
RootlessKit version as a server component, matching the format used
by docker version. This helps users quickly verify which RootlessKit
version is in use without running rootlesskit --version separately.

The version is only shown when rootless mode is active (i.e. 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 is shown without a version string.

Fixes containerd#4936

Signed-off-by: Aaron <aaroniofjm@gmail.com>
@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
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
// 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.

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