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

pipeline does not use docker environment

    XMLWordPrintable

    Details

    • Similar Issues:
    • Epic Link:

      Description

      Pipeline script removes the environment of the docker container for example the python example from the wiki does not work

      pipeline {
        agent { docker 'python:2.7' }
        stages {
          stage('build') {
            steps {
              sh 'pip --version'
              sh 'python --version'
            }
          }
        }
      }
      

      It complains it can not find pip.
      "-BLNTQZUKKFHPWKSPOCWYWUBGIXB3R5GHUR3CBX6DDZ4I7WKFS53Q@tmp/durable-61155246/script.sh: pip: not found"

      Change to /usr/bin/pip and it works, not ideal.

      As well as this '/usr/bin/pip install' does not work, as it can not write to system directories.
      I know virtualenv could be used but this defeats the point of using docker, as docker is the temporary environment.

        Attachments

          Issue Links

            Activity

            madhousez Owen Haynes created issue -
            abayer Andrew Bayer made changes -
            Field Original Value New Value
            Component/s docker-workflow-plugin [ 20625 ]
            Component/s pipeline-model-definition-plugin [ 21706 ]
            Assignee Andrew Bayer [ abayer ]
            Hide
            jglick Jesse Glick added a comment -

            TBD where the actual problem lies.

            Show
            jglick Jesse Glick added a comment - TBD where the actual problem lies.
            jglick Jesse Glick made changes -
            Component/s pipeline-model-definition-plugin [ 21706 ]
            Component/s docker-workflow-plugin [ 20625 ]
            Labels docker
            Hide
            pmarcoen Peter Marcoen added a comment -

            Any update on this Jesse Glick?
            I have the same issue where my Docker image installs some tools and sets the Path environment to include these folders.
            When using pipeline the Path variable from the Docker image is not retained.

            Show
            pmarcoen Peter Marcoen added a comment - Any update on this Jesse Glick ? I have the same issue where my Docker image installs some tools and sets the Path environment to include these folders. When using pipeline the Path variable from the Docker image is not retained.
            dantran dan tran made changes -
            Link This issue relates to JENKINS-40484 [ JENKINS-40484 ]
            jamesdumay James Dumay made changes -
            Epic Link JENKINS-45381 [ 183541 ]
            jamesdumay James Dumay made changes -
            Rank Ranked higher
            jamesdumay James Dumay made changes -
            Rank Ranked lower
            cleclerc Cyrille Le Clerc made changes -
            Description Pipeline script removes the environment of the docker container for example the python example from the wiki does not work

            pipeline {
              agent { docker 'python:2.7' }
              stages {
                stage('build') {
                  steps {
                    sh 'pip --version'
                    sh 'python --version'
                  }
                }
              }
            }

            It complains it can not find pip.
            "-BLNTQZUKKFHPWKSPOCWYWUBGIXB3R5GHUR3CBX6DDZ4I7WKFS53Q@tmp/durable-61155246/script.sh: pip: not found"

            Change to /usr/bin/pip and it works, not ideal.

            As well as this '/usr/bin/pip install' does not work, as it can not write to system directories.
            I know virtualenv could be used but this defeats the point of using docker, as docker is the temporary environment.

            Pipeline script removes the environment of the docker container for example the python example from the wiki does not work

            {code}
            pipeline {
              agent { docker 'python:2.7' }
              stages {
                stage('build') {
                  steps {
                    sh 'pip --version'
                    sh 'python --version'
                  }
                }
              }
            }
            {code}
            It complains it can not find pip.
            "-BLNTQZUKKFHPWKSPOCWYWUBGIXB3R5GHUR3CBX6DDZ4I7WKFS53Q@tmp/durable-61155246/script.sh: pip: not found"

            Change to /usr/bin/pip and it works, not ideal.

            As well as this '/usr/bin/pip install' does not work, as it can not write to system directories.
            I know virtualenv could be used but this defeats the point of using docker, as docker is the temporary environment.

            Hide
            sheerun Adam Stankiewicz added a comment -

            It's how docker works, runs don't see ENV variable sets, only builds.

            Show
            sheerun Adam Stankiewicz added a comment - It's how docker works, runs don't see ENV variable sets, only builds.
            abayer Andrew Bayer made changes -
            Labels docker docker triaged-2018-11

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              madhousez Owen Haynes
              Votes:
              6 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: