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

Docker inspect failing on named multi-stage builds



    • Type: Bug
    • Status: Reopened (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: docker-workflow-plugin
    • Labels:
    • Environment:
      Debian Jessie x64
      Docker Pipeline 1.11
      Jenkins ver. 2.46.3
      Docker version 17.05.0-ce, build 89658be
    • Similar Issues:


      When using named stages in a multistage build as in the example below, the Jenkins pipeline will fail with the following message right after the build has finished.

      Successfully built b59ee5bc6b07
      Successfully tagged bytesheep/odr-dabmux:latest
      [Pipeline] dockerFingerprintFrom
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      java.io.IOException: Cannot retrieve .Id from 'docker inspectalpine:3.6 AS builder'
          at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:193)
          at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:119)
          at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:75)
          at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
          at hudson.security.ACL.impersonate(ACL.java:260)
          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:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:748)
      Finished: FAILURE



      # Build environment
      FROM alpine:3.6 AS builder
      # Create final container
      FROM alpine:3.6
      # Copy artifacts from builder
      COPY --from=builder /usr/local .


      There is a workaround to this issue by removing the names and using the build numbers instead. example:

      FROM alpine:3.6
      FROM alpine:3.6
      COPY --from=0 /usr/local .


      Looking at the related source at #100, it seems the code determains the image name looking at FROM and taking everything until EOL. Which would include 'AS buildname'.

      At a glance it also looks like the code will take the first stage for fingerprinting instead of the final stage (which is the resulting image).


          Issue Links


            m4rcu5 Marcus van Dam created issue -
            philster_jenkins Phil Clay made changes -
            Field Original Value New Value
            Link This issue relates to JENKINS-44789 [ JENKINS-44789 ]
            esmalling Eric Smalling made changes -
            Assignee Eric Smalling [ esmalling ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            jglick Jesse Glick made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            esmalling Eric Smalling made changes -
            Status In Review [ 10005 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            esmalling Eric Smalling made changes -
            Status Resolved [ 5 ] Closed [ 6 ]
            esmalling Eric Smalling made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Reopened [ 4 ]


              • Assignee:
                esmalling Eric Smalling
                m4rcu5 Marcus van Dam
              • Votes:
                40 Vote for this issue
                51 Start watching this issue


                • Created: