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

docker.build throw IOExceptions with some sources

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: docker-workflow-plugin
    • Labels:
      None
    • Environment:
      CloudBees Docker Workflow 1.2
      Workflow 1.10.1
      Jenkins 1.631
      centos7
    • Similar Issues:

      Description

      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

        Attachments

          Activity

          Hide
          jknurek J Knurek added a comment -

          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)
          
          Show
          jknurek J Knurek added a comment - 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)
          Hide
          dimakievua Dmytro Zhernosiekov added a comment -

          Have the same.

          Failed with error
          java.io.IOException: Cannot retrieve .Id from 'docker inspectmicrosoft/dotnet:1.1.2-sdk AS build-env'
          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:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE
          when doing

          def coreImage = docker.build("coremonolith:${env.BUILD_ID}")

          Dockerfile:
          FROM microsoft/dotnet:1.1.2-sdk AS build-env
          ENV ASPNETCORE_ENVIRONMENT Production
          COPY backend/ /app
          WORKDIR /app
          RUN dotnet restore && dotnet publish -c Release -o bin/published/
          WORKDIR /app/bin/published
          ENTRYPOINT dotnet backend.dll
           

          Show
          dimakievua Dmytro Zhernosiekov added a comment - Have the same. Failed with error java.io.IOException: Cannot retrieve .Id from 'docker inspectmicrosoft/dotnet:1.1.2-sdk AS build-env' 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:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE when doing def coreImage = docker.build( "coremonolith:${env.BUILD_ID}" ) Dockerfile: FROM microsoft/dotnet:1.1.2-sdk AS build-env ENV ASPNETCORE_ENVIRONMENT Production COPY backend/ /app WORKDIR /app RUN dotnet restore && dotnet publish -c Release -o bin/published/ WORKDIR /app/bin/published ENTRYPOINT dotnet backend.dll  
          Hide
          levsa Levon Saldamli added a comment - - edited

          I have the same problem when using an ARG in the FROM line, e.g.: 

          FROM $image_name:$version

          This worked fine though:

          FROM some_image_name:$version

          Using the workaround suggested by J Knurek (thanks for the tip!).

           

          Show
          levsa Levon Saldamli added a comment - - edited I have the same problem when using an ARG in the FROM line, e.g.:  FROM $image_name:$version This worked fine though: FROM some_image_name:$version Using the workaround suggested by  J Knurek (thanks for the tip!).  
          Hide
          yeonju YJ Hwang added a comment -

          Same here.

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

          Show
          yeonju YJ Hwang added a comment - Same here. I just removed the tab in front of the image name, then works. please patch this..
          Hide
          raysaltrelli Ray Saltrelli added a comment -

          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.

          Show
          raysaltrelli Ray Saltrelli added a comment - 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.

            People

            • Assignee:
              jglick Jesse Glick
              Reporter:
              henamaral Henrique Amaral
            • Votes:
              9 Vote for this issue
              Watchers:
              18 Start watching this issue

              Dates

              • Created:
                Updated: