• Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • docker-workflow-plugin
    • OSX 10.11, Docker 1.9.1 / Docker 1.10.3, Pipeline 1.15, Docker Pipeline 1.4, Jenkins 2.0-beta-1

      This Pipeline script fails, with the same error reported in https://issues.jenkins-ci.org/browse/JENKINS-33632

      Installed fresh from latest .war file, installed default plugins, added Docker Pipeline, created a job `pipeline`, with the given script:

      node {
          docker.image('maven:3.3.3-jdk-8').inside{
              sh "echo success!"
          }
      }
      

      (Note: I also tried this with/without a node wrapper, with/without the UID hack .inside('-u 1000:50'), but all resulted in the same issue.

      Results in:

      Running on master in /jenkins/2.0-beta-1/workspace/pipeline
      [Pipeline] node {
      [Pipeline] sh
      [pipeline] Running shell script
      + docker inspect -f . maven:3.3.3-jdk-8
      .
      [Pipeline] Run build steps inside a Docker container : Start
      $ docker run -t -d -u 501:20 -w /jenkins/2.0-beta-1/workspace/pipeline -v /jenkins/2.0-beta-1/workspace/pipeline:/jenkins/2.0-beta-1/workspace/pipeline:rw -v /jenkins/2.0-beta-1/workspace/pipeline@tmp:/jenkins/2.0-beta-1/workspace/pipeline@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** maven:3.3.3-jdk-8 cat
      [Pipeline] withDockerContainer {
      [Pipeline] sh
      [pipeline] Running shell script
      sh: 1: cannot create /jenkins/2.0-beta-1/workspace/pipeline@tmp/durable-a6ff18c8/pid: Directory nonexistent
      sh: 1: cannot create /jenkins/2.0-beta-1/workspace/pipeline@tmp/durable-a6ff18c8/jenkins-log.txt: Directory nonexistent
      sh: 1: cannot create /jenkins/2.0-beta-1/workspace/pipeline@tmp/durable-a6ff18c8/jenkins-result.txt: Directory nonexistent
      [Pipeline] } //withDockerContainer
      $ docker stop d47b360cdc3f9e180355415a44ae5a62afc1c2e1ab69c96e4f4d03f9f7daac71
      $ docker rm -f d47b360cdc3f9e180355415a44ae5a62afc1c2e1ab69c96e4f4d03f9f7daac71
      [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
      

          [JENKINS-33962] docker.inside broken on OSX

          Keith Zantow added a comment -

          I believe this may be specific to OSX, using boot2docker, which is why I created a new issue rather than reopening: https://issues.jenkins-ci.org/browse/JENKINS-33632

          Keith Zantow added a comment - I believe this may be specific to OSX, using boot2docker, which is why I created a new issue rather than reopening: https://issues.jenkins-ci.org/browse/JENKINS-33632

          Jacob Blain Christen added a comment - - edited

          As noted on JENKINS-33632, I am seeing this on 1.642.2 with pipeline/workflow updates prior to the 2.0 split and docker-workflow 1.4. Invoking the command manually that jenkins is invoking and delving into the container, I see that the mounted volumes are showing up as owned by root. I wonder if the 1.9 client going against the 1.10 server is causing this.

          Jacob Blain Christen added a comment - - edited As noted on JENKINS-33632 , I am seeing this on 1.642.2 with pipeline/workflow updates prior to the 2.0 split and docker-workflow 1.4. Invoking the command manually that jenkins is invoking and delving into the container, I see that the mounted volumes are showing up as owned by root. I wonder if the 1.9 client going against the 1.10 server is causing this.

          Jesse Glick added a comment -

          Try the recently released (beta) versions of the native Docker executable for Windows or OS X. Do not plan on supporting boot2docker oddities.

          Jesse Glick added a comment - Try the recently released (beta) versions of the native Docker executable for Windows or OS X. Do not plan on supporting boot2docker oddities.

          Michael Neale added a comment -

          yes that type of thing does work on OS-X generally with the beta (I haven't tried wiht the beta from a few days ago).

          I have seen other permission errors with more sophisticated pipelines but the basics certainly work well with non boot2docker on OS-X. I can't speak for windows however.

          Michael Neale added a comment - yes that type of thing does work on OS-X generally with the beta (I haven't tried wiht the beta from a few days ago). I have seen other permission errors with more sophisticated pipelines but the basics certainly work well with non boot2docker on OS-X. I can't speak for windows however.

          Guido Zockoll added a comment - - edited

          I am having the same problem discussed here. When i found this ticket i switches to aws.

          I used docker-machine to create an docker environment in the cloud. Is started Jenkins itself inside a container.

          docker run -d \
            --name jenkins \
            --net build \
            -v jenkins_data:/var/jenkins/data \
            -v /var/run/docker.sock:/var/run/docker.sock \
            -v /usr/bin/docker:/bin/docker \
            -v /etc/timezone:/etc/timezone:ro \
            -p 18080:8080 \
            -p 50000:50000 \
            -e JENKINS_HOME=/var/jenkins/data \
            --restart=always \
            gzockoll/jenkins
          

          In this setup i will get the exact same error:

          [Pipeline] node
          Running on master in /var/jenkins/data/workspace/Inside
          [Pipeline] {
          [Pipeline] sh
          [Inside] Running shell script
          + docker inspect -f . maven:3.3.3-jdk-8
          .
          [Pipeline] withDockerContainer
          $ docker run -t -d -u 0:0 -w /var/jenkins/data/workspace/Inside -v /var/jenkins/data/workspace/Inside:/var/jenkins/data/workspace/Inside:rw -v /var/jenkins/data/workspace/Inside@tmp:/var/jenkins/data/workspace/Inside@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat maven:3.3.3-jdk-8
          [Pipeline] {
          [Pipeline] sh
          [Inside] Running shell script
          sh: 1: cannot create /var/jenkins/data/workspace/Inside@tmp/durable-cceafa54/pid: Directory nonexistent
          sh: 1: cannot create /var/jenkins/data/workspace/Inside@tmp/durable-cceafa54/jenkins-log.txt: Directory nonexistent
          sh: 1: cannot create /var/jenkins/data/workspace/Inside@tmp/durable-cceafa54/jenkins-result.txt: Directory nonexistent
          [Pipeline] }
          $ docker stop 2510def50cb4522fbdf3af532418153ae64edf90f575875544fab47462b1bb70
          $ docker rm -f 2510def50cb4522fbdf3af532418153ae64edf90f575875544fab47462b1bb70
          [Pipeline] // withDockerContainer
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          ERROR: script returned exit code -2
          Finished: FAILURE
          

          So this problem is not dependend on OSX nor boot2docker.

          My Environment: Docker 1.12.1, Jenkins 2.22

          Guido Zockoll added a comment - - edited I am having the same problem discussed here. When i found this ticket i switches to aws. I used docker-machine to create an docker environment in the cloud. Is started Jenkins itself inside a container. docker run -d \ --name jenkins \ --net build \ -v jenkins_data:/ var /jenkins/data \ -v / var /run/docker.sock:/ var /run/docker.sock \ -v /usr/bin/docker:/bin/docker \ -v /etc/timezone:/etc/timezone:ro \ -p 18080:8080 \ -p 50000:50000 \ -e JENKINS_HOME=/ var /jenkins/data \ --restart=always \ gzockoll/jenkins In this setup i will get the exact same error: [Pipeline] node Running on master in / var /jenkins/data/workspace/Inside [Pipeline] { [Pipeline] sh [Inside] Running shell script + docker inspect -f . maven:3.3.3-jdk-8 . [Pipeline] withDockerContainer $ docker run -t -d -u 0:0 -w / var /jenkins/data/workspace/Inside -v / var /jenkins/data/workspace/Inside:/ var /jenkins/data/workspace/Inside:rw -v / var /jenkins/data/workspace/Inside@tmp:/ var /jenkins/data/workspace/Inside@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat maven:3.3.3-jdk-8 [Pipeline] { [Pipeline] sh [Inside] Running shell script sh: 1: cannot create / var /jenkins/data/workspace/Inside@tmp/durable-cceafa54/pid: Directory nonexistent sh: 1: cannot create / var /jenkins/data/workspace/Inside@tmp/durable-cceafa54/jenkins-log.txt: Directory nonexistent sh: 1: cannot create / var /jenkins/data/workspace/Inside@tmp/durable-cceafa54/jenkins-result.txt: Directory nonexistent [Pipeline] } $ docker stop 2510def50cb4522fbdf3af532418153ae64edf90f575875544fab47462b1bb70 $ docker rm -f 2510def50cb4522fbdf3af532418153ae64edf90f575875544fab47462b1bb70 [Pipeline] // withDockerContainer [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: script returned exit code -2 Finished: FAILURE So this problem is not dependend on OSX nor boot2docker. My Environment: Docker 1.12.1, Jenkins 2.22

          Jesse Glick added a comment -

          mehrcurry please read the documentation:

          For inside to work, the Docker server and the Jenkins slave agent must use the same filesystem, so that the workspace can be mounted. Normally this means that the Docker server must be running on localhost.

          Jesse Glick added a comment - mehrcurry please read the documentation : For inside to work, the Docker server and the Jenkins slave agent must use the same filesystem, so that the workspace can be mounted. Normally this means that the Docker server must be running on localhost.

          Jesse Glick added a comment -

          (But if you run the agent inside a container as well, it should use --volumes-from to share the workspace.)

          Jesse Glick added a comment - (But if you run the agent inside a container as well, it should use --volumes-from to share the workspace.)

          Michael Neale added a comment -

          jglick presumably if running inside a container, the docker daemon is bind mounted in so it can be accessed from the agent right?

          Michael Neale added a comment - jglick presumably if running inside a container, the docker daemon is bind mounted in so it can be accessed from the agent right?

          Jesse Glick added a comment -

          if running inside a container, the docker daemon is bind mounted in so it can be accessed from the agent right?

          Well you would have to ensure that if you expected this to work.

          Jesse Glick added a comment - if running inside a container, the docker daemon is bind mounted in so it can be accessed from the agent right? Well you would have to ensure that if you expected this to work.

            jglick Jesse Glick
            kzantow Keith Zantow
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: