Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-57655

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

      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

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

          Pieter Vogelaar created issue -
          Pieter Vogelaar made changes -
          Description Original: The Jenkins docker pipeline provides a very nice docker.image().inside() function. This will result in a docker run command like:
          {code:java}
          docker run -t -d -u 1000:1000 -w /var/jenkins_home/workspace/my-job --volumes-from 30dfde62097dad7873b0c72da82f70252jefewfr72edb412c2e759303d10 -e ******** -e ******** -e ******** my-image:latest cat
          {code}

          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]
          New: The Jenkins docker pipeline provides a very nice docker.image().inside() function. This will result in a docker run command like:
          {code:java}
          docker run -t -d -u 1000:1000 -w /var/jenkins_home/workspace/my-job --volumes-from 30dfde62097dad7873b0c72da82f70252jefewfr72edb412c2e759303d10 -e ******** -e ******** -e ******** my-image:latest cat
          {code}
          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]
          Pieter Vogelaar made changes -
          Labels New: docker plugin
          Felipe Santos made changes -
          Remote Link New: This issue links to "PR#31 (Web Link)" [ 25802 ]

            Unassigned Unassigned
            pietervogelaar Pieter Vogelaar
            Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: