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

Pipeline Docker agent tries to use Docker on stage labeled agent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • docker
    • None
    • Official slim Docker image + Docker inside the image

      Info in original gist shared on IRC.

      https://gist.github.com/altendky/0c5f95abe4737bd7793688879e029887

      Possibly a duplicate of JENKINS-46831.  The title reads one way and the comments read other ways to me.

      Problem

      Caused: java.io.IOException: Cannot run program "docker" (in directory "/home/jenkins/agent/workspace/test"): error=2, No such file or directory

      My impression is that Jenkins is trying to run Docker in the labeled agent due to the pipeline-level Docker agent configuration despite specifying an agent by label for the last stage. Aside from whether this is a unique bug, I am certainly open to suggestions about a better structure for this. Note that in the real case there are many stages that I want run with the pipeline-level specified Docker agent.

      Setup

      • Download the attached files. Run the following `docker-compose` to bring up Jenkins.
        • docker-compose build --build-arg DOCKER_SOCK_GID=$(stat -c '%g' /var/run/docker.sock) && docker-compose up --renew-anon-volumes --remove-orphans
      • Open http://localhost:8080/
      • Enter password from Jenkins startup
      • Select plugins to install
        • Select None
        • Select Install
      • Skip and continue as admin
      • Save and finish
      • Start using Jenkins
      • New Item
        • Set name to test
        • Select pipeline
        • Ok
        • Add the pipeline script below
        • Save
      • Build now

        1. _readme.md
          1 kB
        2. docker-compose.yml
          0.2 kB
        3. jenkins_casc.yaml
          0.4 kB
        4. Jenkinsfile.groovy
          0.4 kB
        5. master.Dockerfile
          0.8 kB
        6. z.log
          8 kB

            csanchez Carlos Sanchez
            altendky Kyle Altendorf
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: