Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrecognized field "LayerSources" with Docker 25.0.0 and from image "docker://" #4171

Closed
derkoe opened this issue Jan 22, 2024 · 14 comments · Fixed by #4172
Closed

Unrecognized field "LayerSources" with Docker 25.0.0 and from image "docker://" #4171

derkoe opened this issue Jan 22, 2024 · 14 comments · Fixed by #4172

Comments

@derkoe
Copy link

derkoe commented Jan 22, 2024

Environment:

  • Jib version: 3.4.0
  • Build tool: Maven 3.5.4
  • OS: Linux

Description of the issue:
Jib error on Docker 25.0.0. with <from><image>docker://eclipse-temurin:8-jre</image></from>:

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.4.0:dockerBuild (default-cli) on project spring-boot-k8s-example: Unrecognized field "LayerSources" (class com.google.cloud.tools.jib.docker.json.DockerManifestEntryTemplate), not marked as ignorable (3 known properties: "Config", "RepoTags", "Layers"])
[ERROR]  at [Source: (sun.nio.ch.ChannelInputStream); line: 1, column: 556] (through reference chain: java.lang.Object[][0]->com.google.cloud.tools.jib.docker.json.DockerManifestEntryTemplate["LayerSources"])

Expected behavior:

Docker daemon as source should work with Docker version 25.0.0

Steps to reproduce:

  1. Install Docker CE 25.0.0 and run the daemon
  2. Clone the Jib Git repository: https://github.com/GoogleContainerTools/jib
  3. cd examples/spring-boot
  4. Add the following configuration to Jib configuration in the pom.xml:
       <from>
           <image>docker://eclipse-temurin:8-jre</image>
       </from>
  5. Pull the Docker base image: docker pull eclipse-temurin:8-jre
  6. Run ./mvnw package jib:dockerBuild

jib-maven-plugin Configuration:

            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>jib-maven-plugin</artifactId>
                <version>3.4.0</version>
                <configuration>
                        <from>
                                <image>docker://eclipse-temurin:8-jre</image>
                        </from>
                </configuration>
            </plugin>

Log output:

[INFO] --- jib-maven-plugin:3.4.0:dockerBuild (default-cli) @ spring-boot-k8s-example ---
[INFO] Tagging image with generated image reference spring-boot-k8s-example:0.1.0. If you'd like to specify a different tag, you can set the <to><image> parameter in your pom.xml, or use the -Dimage=<MY IMAGE> commandline flag.
[WARNING] 'mainClass' configured in 'maven-jar-plugin' is not a valid Java class: ${start-class}
[INFO]
[INFO] Containerizing application to Docker daemon as spring-boot-k8s-example:0.1.0...
[WARNING] Base image 'eclipse-temurin:8-jre' does not use a specific image digest - build may not be reproducible
[INFO] Executing tasks:
[INFO] [===========                   ] 37.5% complete
[INFO] > processing base image eclipse-temurin:8-jre
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.660 s
[INFO] Finished at: 2024-01-22T09:32:47Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:3.4.0:dockerBuild (default-cli) on project spring-boot-k8s-example: Unrecognized field "LayerSources" (class com.google.cloud.tools.jib.docker.json.DockerManifestEntryTemplate), not marked as ignorable (3 known properties: "Config", "RepoTags", "Layers"])
[ERROR]  at [Source: (sun.nio.ch.ChannelInputStream); line: 1, column: 556] (through reference chain: java.lang.Object[][0]->com.google.cloud.tools.jib.docker.json.DockerManifestEntryTemplate["LayerSources"])

Additional Information:
Only happens with Docker 25.0.0 - no issues with older versions of Docker.

@chanseokoh
Copy link
Member

chanseokoh commented Jan 22, 2024

Sounds like Jib needs to fix this to support newer Docker versions. In that case, #4172 should do it.

@mpeddada1
Copy link
Contributor

@derkoe @chanseokoh Thanks for starting this discussion! To better understand the issue, it looks like Jib is return an error when the manifest contains the LayerSources field. I'm curious about where this extra field is coming from. Does this happen regardless of which base image you use? Additionally, I wasn't able to find references to it in the official docs but perhaps you may more context for this.

@chanseokoh
Copy link
Member

@mpeddada1 I have no context about this. Just guessing from @derkoe's comments, the latest Docker may have this field, at least in some cases. But I thought it wouldn't hurt to allow extra fields anyway. @derkoe should answer these.

@derkoe
Copy link
Author

derkoe commented Jan 23, 2024

@mpeddada1 it happens with any image I've tried so far.

@mpeddada1
Copy link
Contributor

Thank you both for the follow-up. Hm @derkoe that is interesting. Are Docker 25 built images always including this field in the manifest now?

@derkoe
Copy link
Author

derkoe commented Jan 23, 2024

I am not talking about images built with Docker 25 - the image format did not change. I am talking about using a Docker installation in version 25 where Jib get's the image from the daemon <image>docker://any-image</image>

@mpeddada1
Copy link
Contributor

I am talking about using a Docker installation in version 25 where Jib get's the image from the daemon <image>docker://any-image</image>

I see, thanks for the clarification.

A follow-up q: do you run into the same issue when using the default base image? Specifically when you don't specify <from><image>docker://any-image</image></from>. Or when pulling in a base image from a container registry like this:

<configuration>
       <from><image>gcr.io/{REPO}/{NAME}:{TAG}</image></from>
</configuration>

@derkoe
Copy link
Author

derkoe commented Jan 29, 2024

@mpeddada1

A follow-up q: do you run into the same issue when using the default base image?

I am using the default base image in my example above: eclipse-temurin:8-jre

Specifically when you don't specify docker://any-image. Or when pulling in a base image from a container registry like this.

The error only occurs when you specifiy the image from with the "docker://" prefix - this is exactly my bug description. It works if you do not specifiy the image.

Again: this error only occurs when the Docker image is loaded from the local Docker daemon with version >= 25. (using the docker:// prefix in the image from).

@HajoRed
Copy link

HajoRed commented Jan 31, 2024

Today I ran into the same problem.

As a workaround I tried to create a tar with docker first by using docker save and then using tar:// as prefix in the image from, but this resulted in them same problem.
So the tar prefix is affected as well, if the tar was created with daemon version >= 25

@Noodlex
Copy link

Noodlex commented Feb 2, 2024

Since this day, bitbucket uses version 25 of docker in the pipelines.
As a result, all my builds fail.
I have no idea of an alternative solution to counter this big problem from my point of view.

@Felix-Seip
Copy link

Is there a timeline to release the fix in the near future?
My Bitbucket pipelines currently don't work since Bitbucket cloud forces Docker v25. I could build the Docker image myself, but I would prefer to keep using jib...

@datenbrille
Copy link

Is there a plan to release it? It is currently breaking our builds too.

@Romeh
Copy link

Romeh commented Feb 21, 2024

hey any due date for the fix release as i see it is fixed in #4172 ?

@mpeddada1
Copy link
Contributor

jib-core:0.26.0, jib-maven-plugin:3.4.1 and jib-gradle-plugin:3.4.1 have been released with this fix. Thanks for reporting @derkoe and thanks for making the fix @chanseokoh!

thpierce added a commit to aws-observability/aws-otel-java-instrumentation that referenced this issue Jun 18, 2024
Upgrade jib

PR workflows are failing due to a somewhat arcane message relating to Docker and jib: https://github.com/aws-observability/aws-otel-java-instrumentation/actions/runs/9568113061/job/26377760995?pr=818

Found an issue that seems at least somewhat related, which was resolved in jib 3.4.1: GoogleContainerTools/jib#4171

In this PR we are upgrading jib from 3.4.0 to 3.4.3, since a) it is generally a good thing to be up to date with dependencies and b) I suspect it will resolve this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants