jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-75139] Docker workflow plugin gets wrong containerId

Open
#728 0 comments 1 reaction 0 assignees View on GitHub
component:docker-workflow-plugin imported-jira-issue priority:blocker resolution:unresolved
Dominant language
Java
Stars
527
Forks
422
Avg merge
10m
Merged PRs (30d)
1

Description

Running Jenkins in rke with RHEL9 nodes, with cgroupv2, the docker plugin gets the wrong containerId from /proc/1/selfmount. Rke creates a "pause" container for each pod, and the jenkins-agent container has the containerId of the pause container in /proc/1/selfmount: https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java#L364 and https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java#L342 - this hostname mount comes from the pause container and not the jenkins container.

The way the plugin has to get the containerId is unreliable for cgroupv2

 

This means that the plugin can't find the volumes used by the jenkins agent container, and will fail to mount them: https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java#L188-L190 . Because of these two lines, I can't even pass the flag "--volumes-from" to the docker args when running the instruction .inside(dockerArgs), because the plugin tries to mount the workspace path from the host, which does not make sense since the workspace only exists in the jenkins container

---
Originally reported by gfigueira, imported from: Docker workflow plugin gets wrong containerId


  • status: Open
  • priority: Blocker
  • component(s): docker-workflow-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 4
  • imported: 2025-12-07

Raw content of original issue

Running Jenkins in rke with RHEL9 nodes, with cgroupv2, the docker plugin gets the wrong containerId from /proc/1/selfmount. Rke creates a "pause" container for each pod, and the jenkins-agent container has the containerId of the pause container in /proc/1/selfmount: https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java#L364 and https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java#L342 - this hostname mount comes from the pause container and not the jenkins container.

The way the plugin has to get the containerId is unreliable for cgroupv2

 

This means that the plugin can't find the volumes used by the jenkins agent container, and will fail to mount them: https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java#L188-L190 . Because of these two lines, I can't even pass the flag "--volumes-from" to the docker args when running the instruction <image>.inside(dockerArgs), because the plugin tries to mount the workspace path from the host, which does not make sense since the workspace only exists in the jenkins container

  • environment: RHEL9, Rocky9

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.