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

docker.inside broken with old client versions

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Blocker
    • Resolution: Won't Fix
    • docker-workflow-plugin

    Description

      create a job called "my job" with the following pipeline

      node ("docker") {
          sh 'pwd'
          img = docker.image("ubuntu")
          img.inside {
              sh 'pwd'
          }
      }
      
      [Pipeline] Allocate node : Start
      Running on docker in /root/workspace/workspace/test-jobs/jnord/docker inside
      [Pipeline] node {
      [Pipeline] sh
      [docker inside] Running shell script
      + pwd
      /root/workspace/workspace/test-jobs/jnord/docker inside
      [Pipeline] sh
      [docker inside] Running shell script
      + docker inspect -f . ubuntu
      .
      [Pipeline] Run build steps inside a Docker container : Start
      $ docker run -t -d -u 0:0 -w "/root/workspace/workspace/test-jobs/jnord/docker inside" -v "/root/workspace/workspace/test-jobs/jnord/docker inside:/root/workspace/workspace/test-jobs/jnord/docker inside:rw" -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** ubuntu cat
      [Pipeline] withDockerContainer {
      [Pipeline] sh
      [docker inside] Running shell script
      sh: 1: cannot create /root/workspace/workspace/test-jobs/jnord/docker inside@tmp/durable-5ea3c644/pid: Directory nonexistent
      sh: 1: cannot create /root/workspace/workspace/test-jobs/jnord/docker inside@tmp/durable-5ea3c644/jenkins-log.txt: Directory nonexistent
      sh: 1: cannot create /root/workspace/workspace/test-jobs/jnord/docker inside@tmp/durable-5ea3c644/jenkins-result.txt: Directory nonexistent
      [Pipeline] } //withDockerContainer
      $ docker stop 260e1e96255fd938e64d6bcd296ce616e01a40ece5ef093dfd97325418247904
      $ docker rm -f 260e1e96255fd938e64d6bcd296ce616e01a40ece5ef093dfd97325418247904
      [Pipeline] Run build steps inside a Docker container : End
      [Pipeline] } //node
      [Pipeline] Allocate node : End
      [Pipeline] End of Pipeline
      ERROR: script returned exit code -2
      Finished: FAILURE
      

      Attachments

        Issue Links

          Activity

            pierrebtz Pierre Beitz added a comment -

            Hello again,

            You are absolutely right and I went debugging again to find out...that the issue was on my side

            To give more context for people coming here, it is in fact the docker that was inside my jenkins docker image that was not correct. I installed it using apt-get install from the official jenkins image which was a mistake as I ended up with a docker client version 1.6.2 (communicating with a docker deamon on my host running a version 12...).
            The problem finally came from the fact the docker inspect output format was changed for volumes in docker 1.8 (I'm pretty sure this comes from this PR). As a consequence, the plugin did not find any volumes, falling back to a --volume mount.

            Installing the latest version of docker using curl -sSL https://get.docker.com/ | sh solved the issue. I guess this means the issue can be closed. If you are interested, I made a pull request to add an error in the logs saying : "The docker version is less than v1.8. Running a 'docker.inside' from inside a container will not work."

            pierrebtz Pierre Beitz added a comment - Hello again, You are absolutely right and I went debugging again to find out...that the issue was on my side To give more context for people coming here, it is in fact the docker that was inside my jenkins docker image that was not correct. I installed it using apt-get install from the official jenkins image which was a mistake as I ended up with a docker client version 1.6.2 (communicating with a docker deamon on my host running a version 12...). The problem finally came from the fact the docker inspect output format was changed for volumes in docker 1.8 (I'm pretty sure this comes from this PR ). As a consequence, the plugin did not find any volumes, falling back to a --volume mount. Installing the latest version of docker using curl -sSL https://get.docker.com/ | sh solved the issue. I guess this means the issue can be closed. If you are interested, I made a pull request to add an error in the logs saying : "The docker version is less than v1.8. Running a 'docker.inside' from inside a container will not work."
            jglick Jesse Glick added a comment -

            There is already a minimum client version specified in the plugin, so this could be updated (or is it the server version which matters?), or we could expand the list of parsable formats. Either way, definitely it would be nice for the plugin to print more helpful diagnostics.

            jglick Jesse Glick added a comment - There is already a minimum client version specified in the plugin, so this could be updated (or is it the server version which matters?), or we could expand the list of parsable formats. Either way, definitely it would be nice for the plugin to print more helpful diagnostics.
            pierrebtz Pierre Beitz added a comment -

            I had a look at the non working and working environment and came up with the following:

            working

            Client:
             Version:      1.12.3
             API version:  1.24
            
            Server:
             Version:      1.12.3
             API version:  1.24
            

            non working

            Client version: 1.6.2
            Client API version: 1.18
            Server version: 1.12.3
            Server API version: 1.24
            

            I guess the client version is the one the plugin should look at then.

            pierrebtz Pierre Beitz added a comment - I had a look at the non working and working environment and came up with the following: working Client: Version: 1.12.3 API version: 1.24 Server: Version: 1.12.3 API version: 1.24 non working Client version: 1.6.2 Client API version: 1.18 Server version: 1.12.3 Server API version: 1.24 I guess the client version is the one the plugin should look at then.

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java
            http://jenkins-ci.org/commit/docker-workflow-plugin/98d2af626cca98f05d358c11431c9f0b5600809b
            Log:
            Merge pull request #80 from PierreBtz/dev

            JENKINS-33632 Add a warning if the detected docker version is less than v1.8

            Compare: https://github.com/jenkinsci/docker-workflow-plugin/compare/eb142f64eba3...98d2af626cca

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java http://jenkins-ci.org/commit/docker-workflow-plugin/98d2af626cca98f05d358c11431c9f0b5600809b Log: Merge pull request #80 from PierreBtz/dev JENKINS-33632 Add a warning if the detected docker version is less than v1.8 Compare: https://github.com/jenkinsci/docker-workflow-plugin/compare/eb142f64eba3...98d2af626cca
            jglick Jesse Glick added a comment - Warning added with https://github.com/jenkinsci/docker-workflow-plugin/pull/80 , thanks!

            People

              pierrebtz Pierre Beitz
              teilo James Nord
              Votes:
              5 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: