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

docker.build throw IOExceptions with some sources

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: docker-workflow-plugin
    • Labels:
      None
    • Environment:
      CloudBees Docker Workflow 1.2
      Workflow 1.10.1
      Jenkins 1.631
      centos7
    • Similar Issues:

      Description

      When we use some images like 'centos:centos7', 'nodesource/centos7:0.12.7' or 'nodesource/jessie:0.12.7', it throws an exception when try to inspect the Id from the source:

      Example:
      FROM nodesource/centos7:0.12.7

      RUN yum install -y epel-release
      RUN yum install -y npm

      Exception:
      Running: Record trace of a Docker image used in FROM
      Running: Allocate node : Body : End
      Running: Allocate node : End
      Running: End of Workflow
      java.io.IOException: Cannot retrieve .Id from 'docker inspect centos:centos7'
      at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:176)
      at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:114)
      at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:74)
      at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:40)
      at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:136)
      at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:112)

      Thanks,
      Henrique

        Attachments

          Activity

          Hide
          briceoliver Brice Oliver added a comment -

          Thanks for the comment Ray Saltrelli.  That was exactly the issue I was running into also.  Removed the "AS <NAME>" from the FROM line (since I didn't the multi-stage name at that point).

          Show
          briceoliver Brice Oliver added a comment - Thanks for the comment Ray Saltrelli .  That was exactly the issue I was running into also.  Removed the "AS <NAME>" from the FROM line (since I didn't the multi-stage name at that point).
          Hide
          christianciach Christian Ciach added a comment -

          Similar issue here.

           

          Dockerfile:

          ARG VERSION=latest
          FROM repo-vp.development.ems:5000/emsys-adoptopenjdk11:$VERSION
          

          Jenkinsfile (declarative):

                    agent { 
                      dockerfile {
                        filename 'Dockerfile'
                        additionalBuildArgs "--build-arg VERSION=${env.JDK_VERSION}"
                        reuseNode true
                      }
                    }
          

          Error log:

          java.io.IOException: Cannot retrieve .Id from 'docker inspect repo-vp.development.ems:5000/emsys-adoptopenjdk11:$VERSION'
          	at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:220)
          	at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:133)
          	at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:85)
          	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
          	at hudson.security.ACL.impersonate(ACL.java:290)
          	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
          	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          	at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE
          
          

          I haven't found a workaround yet.

          Show
          christianciach Christian Ciach added a comment - Similar issue here.   Dockerfile: ARG VERSION=latest FROM repo-vp.development.ems:5000/emsys-adoptopenjdk11:$VERSION Jenkinsfile (declarative): agent { dockerfile { filename 'Dockerfile' additionalBuildArgs "--build-arg VERSION=${env.JDK_VERSION}" reuseNode true } } Error log: java.io.IOException: Cannot retrieve .Id from 'docker inspect repo-vp.development.ems:5000/emsys-adoptopenjdk11:$VERSION' at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:220) at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:133) at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:85) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang. Thread .run( Thread .java:748) Finished: FAILURE I haven't found a workaround yet.
          Hide
          jglick Jesse Glick added a comment -

          The workaround would be to avoid agent dockerfile. Run on a plain agent type and run docker commands explicitly from sh.

          Probably it would be best to deprecate FromFingerprintStep and its kin, since the fingerprints are not actually used anywhere, and remove their calls from Docker.groovy. Alternately, the fingerprinting steps could catch and log all exceptions, never failing.

          Show
          jglick Jesse Glick added a comment - The workaround would be to avoid agent dockerfile . Run on a plain agent type and run docker commands explicitly from sh . Probably it would be best to deprecate FromFingerprintStep and its kin, since the fingerprints are not actually used anywhere, and remove their calls from Docker.groovy . Alternately, the fingerprinting steps could catch and log all exceptions, never failing.
          Hide
          dbensoussan david bensoussan added a comment -

          There is a PR solving this here: https://github.com/jenkinsci/docker-workflow-plugin/pull/162

          Could a maintainer take a look at it?

          Show
          dbensoussan david bensoussan added a comment - There is a PR solving this here: https://github.com/jenkinsci/docker-workflow-plugin/pull/162 Could a maintainer take a look at it?
          Hide
          avindra Avindra Goolcharan added a comment -

          Some PRS got merged, the plugins got updated as well.

           

          https://github.com/jenkinsci/docker-workflow-plugin/pull/162

          https://github.com/jenkinsci/docker-workflow-plugin/pull/180 

           

          I've removed the workarounds from the codebase I saw this issue in, and builds are working as expected while using multi-stage Dockerfiles. 

           

          Would recommend closing this issue.

          Show
          avindra Avindra Goolcharan added a comment - Some PRS got merged, the plugins got updated as well.   https://github.com/jenkinsci/docker-workflow-plugin/pull/162 https://github.com/jenkinsci/docker-workflow-plugin/pull/180     I've removed the workarounds from the codebase I saw this issue in, and builds are working as expected while using multi-stage Dockerfiles.    Would recommend closing this issue.

            People

            • Assignee:
              jglick Jesse Glick
              Reporter:
              henamaral Henrique Amaral
            • Votes:
              19 Vote for this issue
              Watchers:
              26 Start watching this issue

              Dates

              • Created:
                Updated: