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

docker.image.inside fails unexpectedly with Jenkinsfile

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • docker-workflow-plugin
    • None
    • Jenkins 1.651.1 
      CloudBees Docker Pipeline 1.4 
      Pipeline 2.0
      Docker 1.11.0
      RHEL 7.2

      With a simple Jenkinsfile when building, at some point it'll fail for no obvious reason.

      An example Jenkinsfile:

      def img = 'centos:7';
      
      node('docker') {
        stage "pulling";
        sh "docker pull ${img}"; // workaround for JENKINS-34288
      
        checkout scm;
      
        docker.image(img).inside {
          sh 'for i in $(seq 30); do sleep 1; echo $i; done';
          sh 'ls -alh --color';
        }
      }
      

      Partial output:

      [Pipeline] Run build steps inside a Docker container : Start
      $ docker run -t -d -u 995:993 -w /var/lib/jenkins/workspace/tron/docwhat-test-jenkinsfile/master -v /var/lib/jenkins/workspace/tron/docwhat-test-jenkinsfile/master:/var/lib/jenkins/workspace/tron/docwhat-test-jenkinsfile/master:rw -v /var/lib/jenkins/workspace/tron/docwhat-test-jenkinsfile/master@tmp:/var/lib/jenkins/workspace/tron/docwhat-test-jenkinsfile/master@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** centos:7 cat
      [Pipeline] withDockerContainer {
      [Pipeline] sh
      [master] Running shell script
      ++ seq 30
      + for i in '$(seq 30)'
      + sleep 1
      [Pipeline] } //withDockerContainer
      $ docker stop 7fcbfd6ab39cf05257a43a774bd20b670bc39674a2047777fe603ee1a3162b10
      $ docker rm -f 7fcbfd6ab39cf05257a43a774bd20b670bc39674a2047777fe603ee1a3162b10
      [Pipeline] Run build steps inside a Docker container : End
      [Pipeline] } //node
      [Pipeline] Allocate node : End
      [Pipeline] End of Pipeline
      

            jglick Jesse Glick
            docwhat Christian Höltje
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: