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

Docker inspect failing on named multi-stage builds

    XMLWordPrintable

    Details

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

      Description

      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.

      <SNIP>
      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

       

      Dockerfile

      #
      # Build environment
      #
      FROM alpine:3.6 AS builder
      
      <SNIP>
      
      #
      # Create final container
      #
      FROM alpine:3.6
      
      <SNIP>
      
      # 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
      
      <SNIP>
      
      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).

        Attachments

          Issue Links

            Activity

            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 ]

              People

              • Assignee:
                esmalling Eric Smalling
                Reporter:
                m4rcu5 Marcus van Dam
              • Votes:
                30 Vote for this issue
                Watchers:
                44 Start watching this issue

                Dates

                • Created:
                  Updated: