Skip to content

Add runtime field to Docker agent template container settings#1202

Open
Ross-s wants to merge 1 commit intojenkinsci:masterfrom
ExpressThat:feature/runtime-support
Open

Add runtime field to Docker agent template container settings#1202
Ross-s wants to merge 1 commit intojenkinsci:masterfrom
ExpressThat:feature/runtime-support

Conversation

@Ross-s
Copy link
Copy Markdown

@Ross-s Ross-s commented Apr 12, 2026

Adds a runtime field to DockerTemplateBase so users can specify a
container runtime (e.g. sysbox-runc, nvidia) per agent template,
without having to set a default runtime globally in /etc/docker/daemon.json.

Closes #1031

What changed

  • Added runtime field to DockerTemplateBase
  • Wired into HostConfig.withRuntime(runtime) when creating containers
  • Added <f:entry> for Runtime in config.jelly (after Security
    Options), with inline help
  • Added unit tests

Why

The HostConfig API in docker-java already supports .withRuntime(String)
but it was never exposed in the plugin UI. This is a minimal, additive
change with no impact on existing behaviour — the field defaults to null
and is only applied when non-empty.

Use case driving this: running Jenkins agents with
Nestybox Sysbox for secure
Docker-in-Docker without --privileged, which requires --runtime=sysbox-runc.

Testing done

  • Unit test: DockerTemplateBaseTest#testRuntimeField — verifies field
    is stored and retrieved correctly
  • Manual: provisioned a sysbox-runc agent via Jenkins Docker Build Cloud;
    docker info inside the agent confirms DinD is functional

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

Introduces the ability to specify a custom OCI runtime for Docker containers via the `runtime` property in DockerTemplateBase.
@Ross-s Ross-s requested a review from a team as a code owner April 12, 2026 07:09
@MarkEWaite MarkEWaite added the feature a PR providing a new feature. label May 2, 2026
@MarkEWaite MarkEWaite requested a review from Copilot May 2, 2026 12:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds per-template Docker runtime selection to the Jenkins Docker agent configuration so individual agent templates can request a non-default container runtime without changing the Docker daemon’s global default. It extends DockerTemplateBase, exposes the setting in the Jenkins UI, and applies it when building the container HostConfig.

Changes:

  • Added a new runtime field to DockerTemplateBase with databinding support and container creation wiring via HostConfig.withRuntime(...).
  • Added a new Runtime entry and inline help to the Docker template configuration UI.
  • Added unit coverage for applying the runtime during fillContainerConfig(...).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/main/java/com/nirima/jenkins/plugins/docker/DockerTemplateBase.java Adds the runtime property, setter/getter, and applies it to Docker container host configuration.
src/main/resources/com/nirima/jenkins/plugins/docker/DockerTemplateBase/config.jelly Exposes the new runtime field in the Jenkins agent template configuration form.
src/main/resources/com/nirima/jenkins/plugins/docker/DockerTemplateBase/help-runtime.html Documents the new runtime option for users in the UI help.
src/test/java/com/nirima/jenkins/plugins/docker/DockerTemplateBaseTest.java Adds tests for runtime handling in container configuration assembly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


@DataBoundSetter
public void setRuntime(@CheckForNull String runtime) {
this.runtime = runtime == null || runtime.isEmpty() ? null : runtime;
private @CheckForNull List<String> capabilitiesToAdd;
private @CheckForNull List<String> capabilitiesToDrop;

private @CheckForNull String runtime;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature a PR providing a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add runtime docker agent template container option

3 participants