Skip to content

[JENKINS-75139] Docker workflow plugin gets wrong containerId #728

@jenkins-infra-bot

Description

@jenkins-infra-bot

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions