[JIRA] (JENKINS-44836) Docker inspect failing on FROM statements with ARG

213 views
Skip to first unread message

ncosta@fgtsa.com (JIRA)

unread,
Feb 9, 2018, 5:05:04 AM2/9/18
to jenkinsc...@googlegroups.com
Nuno Costa commented on Bug JENKINS-44836
 
Re: Docker inspect failing on FROM statements with ARG

Still an issue with Jenkins 2.105 and docker-workflow 1.15.

Based on Dockerfile with example above, docker image is downloaded, built and tagged but fails on inspect.

Build command:

docker.build("mycentos7", ".")

Error:

...
Status: Downloaded newer image for centos:centos7
 ---> ff426288ea90
Successfully built ff426288ea90
Successfully tagged mycentos7:latest
[Pipeline] dockerFingerprintFrom
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
java.io.IOException: Cannot retrieve .Id from 'docker inspect${BASE_IMAGE}'
	at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:222)
	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
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

caulax@gmail.com (JIRA)

unread,
Jul 5, 2018, 8:57:02 AM7/5/18
to jenkinsc...@googlegroups.com

I just pass ARG to docker image and problem gone

For example:

  • Dockerfile
    ARG BASE_IMAGE=centos:centos7
    FROM ${BASE_IMAGE}
    
  • Build command in Jenkins Pipeline
    docker.build("mycentos7", "--build-arg BASE_IMAGE=centos:centos7 .")
    

    or you can pass your variable like this:

    docker.build("mycentos7", "--build-arg BASE_IMAGE=${JENKINS_VAR_BASE_IMAGE} .")
    
This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

josh@hoblitt.com (JIRA)

unread,
Jul 5, 2018, 10:57:02 AM7/5/18
to jenkinsc...@googlegroups.com

I've discovered the same work around – that you must pass the FROM ARG. However, I vaguely recall that I couldn't get it work with an ARG constructing past of the FROM such as:

ARG BASE
FROM ${BASE}:my-tag

but that issue may have already been resolved.

caulax@gmail.com (JIRA)

unread,
Jul 6, 2018, 3:05:01 AM7/6/18
to jenkinsc...@googlegroups.com

If you want to add default value to AGR look at official docs on docker.com -> ARG -> default values and scope
https://docs.docker.com/engine/reference/builder/#default-values

mirthy@gmail.com (JIRA)

unread,
Aug 7, 2018, 4:20:02 PM8/7/18
to jenkinsc...@googlegroups.com

Similar issue:

If the first line ends with a line continuation character instead of the image tag, it blows up too:

 

FROM \
  mycentos:mytag

You get:
java.io.IOException: Cannot retrieve .Id from 'docker inspect \'

Reply all
Reply to author
Forward
0 new messages