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.

          [JENKINS-41204] pipeline does not use docker environment

          Owen Haynes created issue -
          Andrew Bayer made changes -
          Component/s New: docker-workflow-plugin [ 20625 ]
          Component/s Original: pipeline-model-definition-plugin [ 21706 ]
          Assignee Original: Andrew Bayer [ abayer ]
          Jesse Glick made changes -
          Component/s New: pipeline-model-definition-plugin [ 21706 ]
          Component/s Original: docker-workflow-plugin [ 20625 ]
          Labels New: docker
          dan tran made changes -
          Link New: This issue relates to JENKINS-40484 [ JENKINS-40484 ]
          James Dumay made changes -
          Epic Link New: JENKINS-45381 [ 183541 ]
          James Dumay made changes -
          Rank New: Ranked higher
          James Dumay made changes -
          Rank New: Ranked lower
          Cyrille Le Clerc made changes -
          Description Original: 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.

          New: 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.

          Andrew Bayer made changes -
          Labels Original: docker New: docker triaged-2018-11

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

              Created:
              Updated: