jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-57655] Can volumes-from be disabled for docker.image().inside() in a Jenkins pipeline?

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

Description

The Jenkins docker pipeline provides a very nice docker.image().inside() function. This will result in a docker run command like:

docker run -t -d -u 1000:1000 -w /var/jenkins_home/workspace/my-job --volumes-from 30dfde62097dad7873b0c72da82f70252jefewfr72edb412c2e759303d10 -e ******** -e ******** -e ******** my-image:latest cat


The `--volumes-from` parameter will provide the container with the same volumes as the main Jenkins container. So it will also expose the entire /var/jenkins_home directory.

Sometimes I would like to execute commands in a container and only expose the current job workspace.

Is it possible to disable/remove the `--volumes-from` parameter?

I can add an extra `v ${WORKSPACE}:/workspace` myself as args, but I can't find a way to disable/remove the `-volumes-from` parameter.

 

I also posted this on: https://stackoverflow.com/questions/56277847/can-volumes-from-be-disabled-for-docker-image-inside-in-a-jenkins-pipeline

---
Originally reported by pietervogelaar, imported from: Can volumes-from be disabled for docker.image().inside() in a Jenkins pipeline?


  • status: Open
  • priority: Minor
  • component(s): docker-workflow-plugin
  • label(s): docker, plugin
  • resolution: Unresolved
  • votes: 5
  • watchers: 4
  • imported: 2025-12-07

Raw content of original issue

The Jenkins docker pipeline provides a very nice docker.image().inside() function. This will result in a docker run command like:



docker run -t -d -u 1000:1000 -w /var/jenkins_home/workspace/my-job --volumes-from 30dfde62097dad7873b0c72da82f70252jefewfr72edb412c2e759303d10 -e ******** -e ******** -e ******** my-image:latest cat



The `--volumes-from` parameter will provide the container with the same volumes as the main Jenkins container. So it will also expose the entire /var/jenkins_home directory.
Sometimes I would like to execute commands in a container and only expose the current job workspace.

Is it possible to disable/remove the `--volumes-from` parameter?

I can add an extra `v ${WORKSPACE}:/workspace` myself as args, but I can't find a way to disable/remove the `-volumes-from` parameter.

 

I also posted this on: https://stackoverflow.com/questions/56277847/can-volumes-from-be-disabled-for-docker-image-inside-in-a-jenkins-pipeline

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.