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

Docker 17.05 ARG in FROM breaks docker inspect

    Details

    • Similar Issues:
    • Released As:
      docker-workflow 1.18

      Description

      Taking advantage of https://github.com/moby/moby/issues/18119 is not supported by docker.build.

      Minimal docker file 

      ARG TAG
      FROM image:${TAG}
      

       
      Docker build

      docker.build("image_name", "--build-arg TAG=${package_version} -f Dockerfile .")
      

       

      Stacktrace

      java.io.IOException: Cannot retrieve .Id from 'docker inspectimage:${TAG}'
              at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:203)
              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:745)
      

        Attachments

          Issue Links

            Activity

            Hide
            jhoblitt Joshua Hoblitt added a comment -

            This is also failing for me when the ARG has a default value. Ie., there is no --build-arg to parse.

            ARG FOO=7
            FROM centos:${FOO}
            
            Show
            jhoblitt Joshua Hoblitt added a comment - This is also failing for me when the ARG has a default value. Ie., there is no --build-arg to parse. ARG FOO=7 FROM centos:${FOO}
            Hide
            christianciach Christian Ciach added a comment -

            Probably also a dup of JENKINS-31507.

            I will repeat my comment 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 - Probably also a dup of JENKINS-31507 . I will repeat my comment 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
            christianciach Christian Ciach added a comment -

            I am confused: According to the comments here my example of the previous comment should work since docker-workflow 1.15. I am currently using 1.17, but it still doesn't work.

            Show
            christianciach Christian Ciach added a comment - I am confused: According to the comments here my example of the previous comment should work since docker-workflow 1.15. I am currently using 1.17, but it still doesn't work.
            Hide
            christianciach Christian Ciach added a comment -

            EDIT:

            It looks like my issue is actually a bug in the "pipeline-model-definition-plugin". The plugin creates an instance of `FromFingerprintStep` (a class of this plugin), but fails to set the build-args (`FromFingerprintStep.setBuildArgs(..)`). See here:

            https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/7502d14aa4db891302abf48a2c7de7c9ced97f95/pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy#L83

            Show
            christianciach Christian Ciach added a comment - EDIT: It looks like my issue is actually a bug in the "pipeline-model-definition-plugin". The plugin creates an instance of `FromFingerprintStep` (a class of this plugin), but fails to set the build-args (`FromFingerprintStep.setBuildArgs(..)`). See here: https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/7502d14aa4db891302abf48a2c7de7c9ced97f95/pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy#L83
            Hide
            dnusbaum Devin Nusbaum added a comment -

            The lingering issue with ARGs that specified a default value was fixed in version 1.18 of the Docker Pipeline plugin. See the release notes on the plugin's wiki page for details.

            Show
            dnusbaum Devin Nusbaum added a comment - The lingering issue with ARGs that specified a default value was fixed in version 1.18 of the Docker Pipeline plugin. See the release notes on the plugin's wiki page for details.

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                rpocase Robby Pocase
              • Votes:
                9 Vote for this issue
                Watchers:
                16 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: