#7207·buildkit

Avoid pulling whole Nydus layers to merge cached images

Author: shayonjCreated Sep 28, 2026Updated Sep 28, 2026

Description

A disposable BuildKit daemon can import a registry cache and reuse an unchanged result, but exporting a new Nydus image can still pull its complete old Nydus data blob. MergeNydus calls getBlobWithCompressionWithRetry for every layer before extracting the small per-layer bootstrap. For an imported Nydus descriptor with a remote provider, this materializes the whole blob in the local content store.

A minimal case has a large dependency layer followed by a small source layer:

  1. Build and push a Nydus image. Export a separate registry cache with mode=max,compression=nydus,force-compression=true.
  2. Prune the local BuildKit cache or start a fresh daemon.
  3. Change only the source layer. Import the registry cache, export the cache again, and push the new Nydus image.
  4. Observe the unchanged dependency blob being read into the builder's content store during image export.

The expected behavior is to retain the imported Nydus descriptor and read only the metadata ranges needed for the bootstrap merge. Layers without a usable remote Nydus provider should continue through the existing local conversion path. The cache manifest and final image manifest remain separate.

The current Nydus documentation lists cache import/export as a limitation. This issue is specifically about reusing Nydus data layers from a registry cache while exporting a new final image. A candidate branch with a regression test passes that test on containerd workers after pruning local cache.