jib: Unrecognized field "urls" when attempting to use openjdk:11.0-nanoserver

Environment:

  • Jib 1.8.0
  • Maven 3.3.9 (as deployed with Netbeans 11.0)
  • Windows 10

Description of the issue: Attempting to use a windows build of openjdk docker hub base image fails with the error: Unrecognized field “urls” (class com.google.cloud.tools.jib.image.json.BuildableManifestTemplate$ContentDescriptorTemplate), not marked as ignorable (3 known properties: “size”, “digest”, “mediaType”])

Expected behavior: Project builds and runs correctly on Docker Desktop for Windows setup to run Windows containers.

Steps to reproduce: Using spring-petclinic example because it makes it easy to reproduce. Not the project I am really attempting to work with.

  1. git clone https://github.com/spring-projects/spring-petclinic.git
  2. cd spring-petclinic
  3. mvn package
  4. Edit pom.xml and add jib plugin per information below
  5. mvn -e jib:buildTar <-- This will work
  6. Uncomment any of the Windows base images
  7. mvn -e jib:buildTar <-- This will fail with the error below

jib-maven-plugin Configuration:

            <plugin>
              <groupId>com.google.cloud.tools</groupId>
              <artifactId>jib-maven-plugin</artifactId>
              <version>1.8.0</version>
              <configuration>
                <to>
                  <image>docker.io/nsharp/test_app</image>
                </to>
                <from>
                   <image>openjdk@sha256:221f36c282ea61f4121e1c6380a76bed8e3757e3aeb29c6fbf869bf832638454</image> <!-- latest linux/amd64 -->
                   <!-- <image>openjdk@sha256:399788bfd0f26e9bcbd45d21d0b7f0409392e51e7d9eae03d293fb89f214a145</image> --> <!-- latest windows/amd64 -->
                   <!-- <image>openjdk@sha256:0e1fe0b1652ba6047a7f0be5a6c66f63ecc5bbb0a36eab52b829bc74f02e58d6</image> --> <!-- 11.0-windowsservercore -->
                   <!-- <image>openjdk@sha256:3f8305d1ec68251f3b2f22f6dfe00571c11e2d367e2de4c47524ebd654f3a4d7</image> --> <!-- 11.0-nanoserver -->
                </from>
              </configuration>
            </plugin>     

Log output:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.779 s
[INFO] Finished at: 2020-01-07T10:55:38-05:00
[INFO] Final Memory: 28M/97M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.8.0:buildTar (default-cli) on project spring-petclinic: Unrecognized field "urls" (class com.google.cloud.tools.jib.image.json.BuildableManifestTemplate$ContentDescriptorTemplate), not marked as ignorable (3 known properties: "size", "digest", "mediaType"])
[ERROR] at [Source: (String)"{
[ERROR] "schemaVersion": 2,
[ERROR] "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
[ERROR] "config": {
[ERROR] "mediaType": "application/vnd.docker.container.image.v1+json",
[ERROR] "size": 3200,
[ERROR] "digest": "sha256:8c9b0ced90247b0e0d29ffb16d0e16480cec7e34d3c360340f076373d8f1c38c"
[ERROR] },
[ERROR] "layers": [
[ERROR] {
[ERROR] "mediaType": "application/vnd.docker.image.rootfs.foreign.diff.tar.gzip",
[ERROR] "size": 101106116,
[ERROR] "digest": "sha256:1951f408509ba9ddcf240ef5d838c72c5596f97a05"[truncated 2082 chars]; line: 14, column: 19] (through reference chain: com.google.cloud.tools.jib.image.json.V22ManifestTemplate["layers"]->java.util.ArrayList[0]->com.google.cloud.tools.jib.image.json.BuildableManifestTemplate$ContentDescriptorTemplate["urls"])
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.8.0:buildTar (default-cli) on project spring-petclinic: Unrecognized field "urls" (class com.google.cloud.tools.jib.image.json.BuildableManifestTemplate$ContentDescriptorTemplate), not marked as ignorable (3 known properties: "size", "digest", "mediaType"])
 at [Source: (String)"{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
   "config": {
      "mediaType": "application/vnd.docker.container.image.v1+json",
      "size": 3200,
      "digest": "sha256:8c9b0ced90247b0e0d29ffb16d0e16480cec7e34d3c360340f076373d8f1c38c"
   },
   "layers": [
      {
         "mediaType": "application/vnd.docker.image.rootfs.foreign.diff.tar.gzip",
         "size": 101106116,
         "digest": "sha256:1951f408509ba9ddcf240ef5d838c72c5596f97a05"[truncated 2082 chars]; line: 14, column: 19] (through reference chain: com.google.cloud.tools.jib.image.json.V22ManifestTemplate["layers"]->java.util.ArrayList[0]->com.google.cloud.tools.jib.image.json.BuildableManifestTemplate$ContentDescriptorTemplate["urls"])
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unrecognized field "urls" (class com.google.cloud.tools.jib.image.json.BuildableManifestTemplate$ContentDescriptorTemplate), not marked as ignorable (3 known properties: "size", "digest", "mediaType"])
 at [Source: (String)"{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
   "config": {
      "mediaType": "application/vnd.docker.container.image.v1+json",
      "size": 3200,
      "digest": "sha256:8c9b0ced90247b0e0d29ffb16d0e16480cec7e34d3c360340f076373d8f1c38c"
   },
   "layers": [
      {
         "mediaType": "application/vnd.docker.image.rootfs.foreign.diff.tar.gzip",
         "size": 101106116,
         "digest": "sha256:1951f408509ba9ddcf240ef5d838c72c5596f97a05"[truncated 2082 chars]; line: 14, column: 19] (through reference chain: com.google.cloud.tools.jib.image.json.V22ManifestTemplate["layers"]->java.util.ArrayList[0]->com.google.cloud.tools.jib.image.json.BuildableManifestTemplate$ContentDescriptorTemplate["urls"])
        at com.google.cloud.tools.jib.maven.BuildTarMojo.execute(BuildTarMojo.java:127)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "urls" (class com.google.cloud.tools.jib.image.json.BuildableManifestTemplate$ContentDescriptorTemplate), not marked as ignorable (3 known properties: "size", "digest", "mediaType"])
 at [Source: (String)"{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
   "config": {
      "mediaType": "application/vnd.docker.container.image.v1+json",
      "size": 3200,
      "digest": "sha256:8c9b0ced90247b0e0d29ffb16d0e16480cec7e34d3c360340f076373d8f1c38c"
   },
   "layers": [
      {
         "mediaType": "application/vnd.docker.image.rootfs.foreign.diff.tar.gzip",
         "size": 101106116,
         "digest": "sha256:1951f408509ba9ddcf240ef5d838c72c5596f97a05"[truncated 2082 chars]; line: 14, column: 19] (through reference chain: com.google.cloud.tools.jib.image.json.V22ManifestTemplate["layers"]->java.util.ArrayList[0]->com.google.cloud.tools.jib.image.json.BuildableManifestTemplate$ContentDescriptorTemplate["urls"])
        at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
        at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:823)
        at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1153)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1589)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1567)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:294)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
        at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
        at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4014)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3005)
        at com.google.cloud.tools.jib.json.JsonTemplateMapper.readJson(JsonTemplateMapper.java:118)
        at com.google.cloud.tools.jib.registry.ManifestPuller.getManifestTemplateFromJson(ManifestPuller.java:149)
        at com.google.cloud.tools.jib.registry.ManifestPuller.handleResponse(ManifestPuller.java:99)
        at com.google.cloud.tools.jib.registry.ManifestPuller.handleResponse(ManifestPuller.java:45)
        at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call(RegistryEndpointCaller.java:141)
        at com.google.cloud.tools.jib.registry.RegistryEndpointCaller.call(RegistryEndpointCaller.java:115)
        at com.google.cloud.tools.jib.registry.RegistryClient.callRegistryEndpoint(RegistryClient.java:473)
        at com.google.cloud.tools.jib.registry.RegistryClient.pullManifest(RegistryClient.java:303)
        at com.google.cloud.tools.jib.registry.RegistryClient.pullManifest(RegistryClient.java:307)
        at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.pullBaseImage(PullBaseImageStep.java:205)
        at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.call(PullBaseImageStep.java:165)
        at com.google.cloud.tools.jib.builder.steps.PullBaseImageStep.call(PullBaseImageStep.java:59)
        at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
        at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
        at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Additional Information:

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (11 by maintainers)

Most upvoted comments

@phxnsharp we’ve released Jib 2.1.0, which fixes the bug that prevented loading local Docker images on Windows (#2270). At least you can now load local Docker images on Windows. However, as mentioned in #2270, building Windows containers is basically not supported.

There’s a way to test building a Windows image with Jib. After you do docker pull openjdk@sha256:3f8305d1ec68251f3b2f22f6dfe00571c11e2d367e2de4c47524ebd654f3a4d7 (perhaps give it a different name for convenience), you can instruct Jib to use the image in the Docker daemon cache: <from><image>docker://openjdk@sha256:3f8305d1ec68251f3b2f22f6dfe00571c11e2d367e2de4c47524ebd654f3a4d7</image></from>. (However, using an image in Docker is very slow and inefficient.)

I’m personally curious to see if Jib-built Windows images will work. If so, it’s an incentive for us to fix this issue. Even if it doesn’t work, it’d be very useful for us to know if we should do a lot of work to support building Windows images in the future.

Thanks for the update. Unfortunately, this is quite involved to support in Jib.

Note to self:

  • If the Jib cache is empty, Docker Hub returns 404 (and fail) in the first run. Interestingly, subsequent runs return 401. Worth understanding why.

  • The media type for the blob hosted on a different server is “application/vnd.docker.image.rootfs.foreign.diff.tar.gzip”.

    "layers": [
       {
          "mediaType": "application/vnd.docker.image.rootfs.foreign.diff.tar.gzip",
          "size": 101106116,
          "digest": "sha256:1951f408509ba9ddcf240ef5d838c72c5596f97a05b063446508f2ba15d510f2",
          "urls": [
             "https://mcr.microsoft.com/v2/windows/nanoserver/blobs/sha256:1951f408509ba9ddcf240ef5d838c72c5596f97a05b063446508f2ba15d510f2"
          ]
       },
       {
          "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
          "size": 945,
          "digest": "sha256:163d55b77f49371136083ba8066ddbec4afad6e1f4fbba77fa4ffebc99a8098a"
       },
    

    About the “foreign” layer media type, the Docker spec says

    Layers of type application/vnd.docker.image.rootfs.foreign.diff.tar.gzip may be pulled from a remote location but they should never be pushed.

    OTOH, the OCI spec doesn’t seem to have a “foreign” layer media type. Looks like the OCI spec equivalent to the Docker “foreign” layer type is the “non-distributable” type (can be gzip, tar, etc.).

So when Jib asks for it, the registry says it doesn’t have it.

Very weird. An hour ago, Docker Hub returned 404 for the layers with urls. Now, it’s returning 401 for them. I wonder if they are actively changing these Windows repositories or the general policy right now.

Thanks for reporting this.

The OCI spec lists urls and annotations as optional properties. We should not fail if they are present. I’ll fix this.