Skip to content

builder-noble-java-tiny:0.0.56 produces zero length layers which can cause tooling issuess #52

@philwebb

Description

@philwebb

Expected Behavior

When using builder-noble-java-tiny:0.0.56 to generate an image, all included layers should have a non-zero length. Zero byte layers seem to cause issues with some publishing tools and with tools such as dive.

This issue was first reported at spring-projects/spring-boot#47022.

Current Behavior

Running pack with builder-noble-java-tiny:0.0.56 produces a docker image that has zero byte layers.

Steps to Reproduce

A sample project to reproduce the issue is available in demo-image-issue.zip. It needs to be built with Apache Maven.

Once the project has been built, run pack to generate an image:

$ pack build demo-image-issue --builder paketobuildpacks/builder-noble-java-tiny:latest --env BP_JVM_VERSION=21 --path ./target/demo-image-issue-0.0.1-SNAPSHOT.jar

Save the image and extract and view the manifest to inspect the JSON:

$ docker image save demo-image-issue | tar -xf - manifest.json && cat manifest.json | jq

The result is:

[
  {
    "Config": "blobs/sha256/0a05309c5285563eb3091f85153f5347c021a4b0d91ae9ec39583d0aa3be6014",
    "RepoTags": [
      "demo-image-issue:latest"
    ],
    "Layers": [
      "blobs/sha256/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
      "blobs/sha256/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
      "blobs/sha256/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
      "blobs/sha256/3e74b876fa888a7265efcbe547e07018ccda0421797d9ae6cbf185d6d1d5508c",
      "blobs/sha256/e13f32b89503082d9d076df31b0ab4fe367f17308145e2e9777332f52351305f",
      "blobs/sha256/5f4c1d5773eb3a00ebec6070263004ec60faf7311ea4db1ac5ff045aecd165f8",
      "blobs/sha256/a4124ebfe5c4a63a1f5020c530f176f0fb62c2edc2e0c87220cb0bba6d159b74",
      "blobs/sha256/b8578b8a2ac51f7abdfdd4eea28bc34a73920771ba01df61f9f6d30f2bbc0dfe",
      "blobs/sha256/d6ecce2bcb621e3b99b3fadd213faf56a32a4d221855c6726d317a931b97401e",
      "blobs/sha256/2cdf5b962e8ece0e546450ea779424e3420db80186dfafc0a0f44d172cee1c2f",
      "blobs/sha256/bc7f82c871ffa12af89cd62c3047e5289ce24fbbe07f7adeeb840ccd43140f20",
      "blobs/sha256/8e326708c473538285f07c789947ca89fa19fbbd7ae08333ec883c0fcba4d7cc",
      "blobs/sha256/cc3c0e569c3cd1ea2ca983256c6dc1c4ef10fe3c381b1fa0c450925c257dde94",
      "blobs/sha256/24d5d2eaea1e2fc53ad9e081541acb105a2ae62a6dcffb875dec06b573149c0a",
      "blobs/sha256/89732bc7504122601f40269fc9ddfb70982e633ea9caf641ae45736f2846b004",
      "blobs/sha256/891c5ef4572e1828d36c43534cacffd20bda39314b768e995bc327f475e2be96",
      "blobs/sha256/89732bc7504122601f40269fc9ddfb70982e633ea9caf641ae45736f2846b004",
      "blobs/sha256/34061cc4ad826866fb162f006f0a8e7b98cf4c6d4ae8644335d5fce00c345027",
      "blobs/sha256/f7f72ce47a0b7ddbe653dbe7ae8304e39f8ac3f29a8f16cd0623223373b4936e",
      "blobs/sha256/b39b18afe74ec7ee652aed10c5c3e637af7e7daad3da9380043a93fe7d212d44"
    ]
  }
]

The top three layers (with sha e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855) all have 0 bytes.

Running dive gives the following error:

$ dive  demo-image-issue
Image Source: docker://demo-image-issue-l
Extracting image from docker-engine... (this can take a while for large images)
cannot fetch image
EOF

Some Docker registries may also reject this manifest

Running the same pack command with 0.0.55 of the builder produces a different result:

$ pack build demo-image-issue --builder paketobuildpacks/builder-noble-java-tiny:0.0.55 --env BP_JVM_VERSION=21 --path ./target/demo-image-issue-0.0.1-SNAPSHOT.jar
$ docker image save demo-image-issue | tar -xf - manifest.json && cat manifest.json | jq

Now gives:

[
  {
    "Config": "blobs/sha256/5d6e19b261e7fec3ae6ac29665eeaea85acf8063f2ae7a26b63ddc05fc541583",
    "RepoTags": [
      "demo-image-issue:latest"
    ],
    "Layers": [
      "blobs/sha256/8637476602cf2504187f2da7bc4b67fe11ea77b97d8506d33b791aaeac110e76",
      "blobs/sha256/72c283668f14198365eace6c60701babd1fa267eac2b647fbad0352d0c97af86",
      "blobs/sha256/aac046430871674bd6f2219bb468681c5b3338f1e06ab4c14197bb5885968ad3",
      "blobs/sha256/5b6f8eaa5fccd62d95fffce6fecfd06b35f5fd04417d0412e61339005d028490",
      "blobs/sha256/9f6e2a03234306101ca35e7e361bd3f08fc4d55beeeacd8c351204106e29aae3",
      "blobs/sha256/bea0a3dc2651cac7c9c567a5cb4e7536107b357cb9113e8806f690f050500012",
      "blobs/sha256/03160ce98d2ab327ffbb1a513d2d758f57214b22ffafc035151801da7e84ca5c",
      "blobs/sha256/417e5bfc3c82b9373cf6804206e071d2fc74560df867d0f39cb21ac3d15231b6",
      "blobs/sha256/e8dc1c799ea8bf3d9a939276b9b4a6ae15843738f1c1ef94239dc51b2ea62f3c",
      "blobs/sha256/f0e9078fd509b2493bcef1215b4de825d53f118ef0648b850edec03dc6e3cfd4",
      "blobs/sha256/366ce7d1a7f90f2e4ad08752f87510eee3ffca18736fa63c03823c8c4ebf2925",
      "blobs/sha256/a7dca6c9996468c5b91aec53520bc781895168f949c93815ac501062411c153f",
      "blobs/sha256/f0d0405d31af85d016a44d855faf4fad2bcf23e3b31ebb3c313f4714c7ffeea7",
      "blobs/sha256/92b2ae71f144e493fd8c6172dfd184b430c316ddbda3a565cdfaa47fc667fbc0",
      "blobs/sha256/5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
      "blobs/sha256/e22c76e803cb583614fe12bc6090b68f2cfdabc0700dca0a97627bbf4226c464",
      "blobs/sha256/89732bc7504122601f40269fc9ddfb70982e633ea9caf641ae45736f2846b004",
      "blobs/sha256/787c1f3510bd8ba56dd3944d217ed6f8a53c6eda5d55a11fbeee1c189dec9a3f",
      "blobs/sha256/dc62fc7eb1a822b0d70fc11a4cbef7a7c804c699374c6c312695cbffd6a995b9",
      "blobs/sha256/1dc94a70dbaa2171fb086500a5d27797f779219b126b0a1eebb9180c2792e80e"
    ]
  }
]

Using dive on this image works.

Motivations

It's possible that zero length layers are valid, however, it does appear to cause problems with certain tools and registries so it would be nice to know if the change was intentional.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions