[JIRA] [workflow-plugin] (JENKINS-31507) docker.build throw IOExceptions with some sources

212 views
Skip to first unread message

hen.amaral@gmail.com (JIRA)

unread,
Nov 11, 2015, 1:14:02 PM11/11/15
to jenkinsc...@googlegroups.com
Henrique Amaral created an issue
 
Jenkins / Bug JENKINS-31507
docker.build throw IOExceptions with some sources
Issue Type: Bug Bug
Assignee: Jesse Glick
Components: workflow-plugin
Created: 11/Nov/15 6:13 PM
Environment: CloudBees Docker Workflow 1.2
Workflow 1.10.1
Jenkins 1.631
centos7
Priority: Minor Minor
Reporter: Henrique Amaral

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

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

jglick@cloudbees.com (JIRA)

unread,
Nov 12, 2015, 8:16:02 AM11/12/15
to jenkinsc...@googlegroups.com
Jesse Glick updated an issue
Change By: Jesse Glick
Component/s: docker-workflow-plugin
Component/s: workflow-plugin

jglick@cloudbees.com (JIRA)

unread,
Nov 12, 2015, 8:18:01 AM11/12/15
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-31507
 
Re: docker.build throw IOExceptions with some sources

Hmm,

$ docker inspect -f '{{.Id}}' centos:centos7
ae0c2d0bdc100993f7093400f96e9abab6ddd9a7c56b0ceba47685df5a8fe906

works for me. What does docker version say? Do you have a self-contained script to reproduce?

hen.amaral@gmail.com (JIRA)

unread,
Nov 12, 2015, 8:27:01 AM11/12/15
to jenkinsc...@googlegroups.com

Hi Jesse, it worked when you run with the terminal, only fails when you run from the workflow-docker-plugin.
The docker version is: 1.8.3

jglick@cloudbees.com (JIRA)

unread,
Nov 12, 2015, 9:28:02 AM11/12/15
to jenkinsc...@googlegroups.com

Interesting, should just be running that command internally. Will check if I can reproduce. Do you have only one version of Docker installed on the system?

hen.amaral@gmail.com (JIRA)

unread,
Nov 12, 2015, 10:28:01 AM11/12/15
to jenkinsc...@googlegroups.com

Yes, I have only one version running in a CentOS 7 and the CentOS is a jenkins slave.

josh_marston@partech.com (JIRA)

unread,
Aug 12, 2016, 3:29:02 PM8/12/16
to jenkinsc...@googlegroups.com

I just got the same issue building from centos:centos7 on a Jenkins slave:

java.io.IOException: Cannot retrieve .Id from 'docker inspect[REPO] -t [TAG]'
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:184)
at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:116)
at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:76)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:40)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:178)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:124)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:117)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:16)

Any workaround for this?

This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

bhunt@mac.com (JIRA)

unread,
Oct 6, 2016, 5:44:02 PM10/6/16
to jenkinsc...@googlegroups.com

I have just run into this problem. I have several projects that all use the same function to build a docker image. The one I set up a few minutes ago is throwing this same exception. The other projects seem to build fine.

java.io.IOException: Cannot retrieve .Id from 'docker inspect      gpuwa-docker.nvidia.com/java:8u102-1.1.0'
	at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:190)
	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:52)
	at hudson.security.ACL.impersonate(ACL.java:221)
	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:49)
	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)

jglick@cloudbees.com (JIRA)

unread,
Oct 7, 2016, 4:39:01 PM10/7/16
to jenkinsc...@googlegroups.com

The extra whitespace looks suspicious, perhaps you have FROM␣␣␣␣something? As usual, a self-contained, minimal, reproducible test case would expedite a fix (as well as possibly make a workaround obvious).

sac_gupt@yahoo.com (JIRA)

unread,
Oct 10, 2016, 6:00:01 PM10/10/16
to jenkinsc...@googlegroups.com

I got exactly same issue as @Bryan I have a base image and several dependent images use this base to build. One of them is consistently throwing this error, othrs are good.

[Pipeline] dockerFingerprintFrom
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.io.IOException: Cannot retrieve .Id from 'docker inspect ******/atlas_base'
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:184)
at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:120)


at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:76)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:40)

at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:157)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:117)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:117)
at groovy.lang.GroovyObject$invokeMethod$1.call(Unknown Source)


at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)

I looked at this failure code at https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java and ran the inspect command from command line as the code does. This works

  1. docker inspect -f=".Id" *****/atlas_base
    sha256:336e0afe9988898976f28db21baf804af4dfff66a8d94ec3c372f459f8729d25

sac_gupt@yahoo.com (JIRA)

unread,
Oct 10, 2016, 7:48:02 PM10/10/16
to jenkinsc...@googlegroups.com
Sachin Gupta edited a comment on Bug JENKINS-31507
I got exactly same issue as @Bryan I have a base image and several dependent images use this base to build. One of them is consistently throwing this error, othrs others are good.


[Pipeline] dockerFingerprintFrom
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.io.IOException: Cannot retrieve .Id from 'docker inspect ******/atlas_base'
at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:184)
at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:120)
at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:76)
at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:40)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:157)
at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:117)
at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:117)
at groovy.lang.GroovyObject$invokeMethod$1.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)


I looked at this failure code at https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/client/DockerClient.java and ran the inspect command from command line as the code does. This works

# docker inspect -f="{{.Id}}" *****/atlas_base
sha256:336e0afe9988898976f28db21baf804af4dfff66a8d94ec3c372f459f8729d25

bhunt@mac.com (JIRA)

unread,
Oct 11, 2016, 11:19:02 AM10/11/16
to jenkinsc...@googlegroups.com

I got my build to work. In my case, my Dockerfile looked like:

FROM            gpuwa-docker.nvidia.com/java:8u102-1.1.0
MAINTAINER Bryan Hunt
...

Changing the Dockerfile as shown below got worked.

FROM gpuwa-docker.nvidia.com/java:8u102-1.1.0
MAINTAINER Bryan Hunt
...

bhunt@mac.com (JIRA)

unread,
Oct 11, 2016, 11:20:03 AM10/11/16
to jenkinsc...@googlegroups.com
Bryan Hunt edited a comment on Bug JENKINS-31507
I got my build to work.  In my case, my Dockerfile looked like:

{noformat}

FROM            gpuwa-docker.nvidia.com/java:8u102-1.1.0
MAINTAINER Bryan Hunt
...
{noformat}


Changing the Dockerfile as shown below got worked.

{noformat}

FROM gpuwa-docker.nvidia.com/java:8u102-1.1.0
MAINTAINER Bryan Hunt
...
{noformat}

bhunt@mac.com (JIRA)

unread,
Oct 11, 2016, 11:20:05 AM10/11/16
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Oct 11, 2016, 12:00:01 PM10/11/16
to jenkinsc...@googlegroups.com

So possibly this just needs a .trim(); should be easy enough to reproduce in a functional test.

sac_gupt@yahoo.com (JIRA)

unread,
Oct 11, 2016, 1:51:03 PM10/11/16
to jenkinsc...@googlegroups.com

My issue was fixed. Just trimmed the space between FROM <base_image> to FROM <base_image>

{single space between FROM and image name}

Thanks!!

yasmanycm@gmail.com (JIRA)

unread,
Nov 24, 2016, 6:35:01 AM11/24/16
to jenkinsc...@googlegroups.com

Same issue here, any plan for fixing this? Dockerfile usually will be formatted using this tabs and spaced for better looking

davidmichaelkarr@gmail.com (JIRA)

unread,
Jan 10, 2017, 5:07:02 PM1/10/17
to jenkinsc...@googlegroups.com

I've seen the same problem and resolution. This is definitely a bug. I never would have figured out how to resolve this if I didn't see this bug report.

glon.sebastien@free.fr (JIRA)

unread,
Feb 16, 2017, 9:30:01 AM2/16/17
to jenkinsc...@googlegroups.com

same for me
Multi space between FROM and image name

glon.sebastien@free.fr (JIRA)

unread,
Feb 16, 2017, 9:36:01 AM2/16/17
to jenkinsc...@googlegroups.com
sébastien glon edited a comment on Bug JENKINS-31507
same for me
Multi space between FROM and image name
on Dockerfile

knurek.j@gmail.com (JIRA)

unread,
Mar 30, 2017, 10:12:03 AM3/30/17
to jenkinsc...@googlegroups.com
J Knurek commented on Bug JENKINS-31507

I'm seeing a similar error, but I think the root cause in my case is different.

My pipeline has the following:

    docker.withRegistry('https://quay.io', 'quay-robot') {
        def imageName = "test/example:123"
        def img = docker.build(imageName)
    }
 

and the logs show this, (notice there is no space at all between the image name)
Cannot retrieve .Id from 'docker inspecttest/example:123

docker build -t test/example:123 .
Sending build context to Docker daemon 25.35 MB

Step 1 : FROM alpine:latest
 ---> 4a415e366388
Step 2 : MAINTAINER 
...
Step 6 : ENTRYPOINT /docker-entrypoint.sh
 ---> Running in 7a1c46850107
 ---> fb2dfcecf73a
Removing intermediate container 7a1c46850107
Successfully built fb2dfcecf73a
[Pipeline] dockerFingerprintFrom
Executing command: docker inspect -f {{.Id}} test/example:123 

java.io.IOException: Cannot retrieve .Id from 'docker inspecttest/example:123'
    at org.jenkinsci.plugins.docker.workflow.client.DockerClient.inspectRequiredField(DockerClient.java:192)
    at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:115)
    at org.jenkinsci.plugins.docker.workflow.FromFingerprintStep$Execution.run(FromFingerprintStep.java:75)
    at 

I've settled on a work-around by doing:

        sh "docker build -t ${imageName}  ."
        def img = docker.image(imageName)
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

lala7573@gmail.com (JIRA)

unread,
Apr 19, 2018, 10:53:03 PM4/19/18
to jenkinsc...@googlegroups.com
YJ Hwang commented on Bug JENKINS-31507

Same here.

I just removed the tab in front of the image name, then works. please patch this..

raymond.saltrelli@protonmail.com (JIRA)

unread,
Jul 11, 2018, 1:22:02 PM7/11/18
to jenkinsc...@googlegroups.com

I ran into this issue but in a slightly different way.

 
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS runtime
 
... yields ...
 
java.io.IOException: Cannot retrieve .Id from 'docker inspect microsoft/dotnet:2.1-aspnetcore-runtime AS runtime'
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
 
The "AS runtime" was what was causing problems for me.  Fortunately it wasn't necessary so I deleted it.

This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

brice.oliver@gmail.com (JIRA)

unread,
Jul 19, 2018, 2:09:03 PM7/19/18
to jenkinsc...@googlegroups.com

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).

christian.ciach@gmail.com (JIRA)

unread,
Feb 26, 2019, 8:46:02 AM2/26/19
to jenkinsc...@googlegroups.com

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.

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jglick@cloudbees.com (JIRA)

unread,
Mar 1, 2019, 6:19:03 PM3/1/19
to jenkinsc...@googlegroups.com

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.

minipada@gmail.com (JIRA)

unread,
Apr 18, 2019, 11:48:19 AM4/18/19
to jenkinsc...@googlegroups.com

aavindraa@gmail.com (JIRA)

unread,
Oct 1, 2019, 1:38:03 PM10/1/19
to jenkinsc...@googlegroups.com

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.

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages