Skip to content

Commit

Permalink
Solver: disable inline cache export for nydus compression type
Browse files Browse the repository at this point in the history
Since the nydus image layer does not correspond to the cache records,
the inline cache export of nydus image is disabled here.

Signed-off-by: Yan Song <imeoer@linux.alibaba.com>
  • Loading branch information
imeoer committed Feb 17, 2022
1 parent 55a3d93 commit a9362be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/nydus.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ buildctl build ... \

- The export of Nydus image and runtime (e.g. [docker](https://github.com/dragonflyoss/image-service/tree/master/contrib/docker-nydus-graphdriver), [containerd](https://github.com/containerd/nydus-snapshotter), etc.) is currently only supported on linux platform.
- Nydus image layers cannot be mixed with other compression types in the same image, so the `force-compression=true` option is automatically enabled when exporting both Nydus compression type and other compression types.
- Since the Nydus image layer does not correspond to the cache records, the inline cache export of Nydus image is unsupported.
- Specifying a Nydus image as a base image in a Dockerfile is not currently supported (i.e. lazily pull using a Nydus image).

### Other ways to create Nydus images
Expand Down
6 changes: 6 additions & 0 deletions solver/llbsolver/solver.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ func inlineCache(ctx context.Context, e remotecache.Exporter, res solver.CachedR
if efl, ok := e.(interface {
ExportForLayers(context.Context, []digest.Digest) ([]byte, error)
}); ok {
if compressionopt.Type == compression.NydusBlob {
// Since the nydus image layer does not correspond to the cache records,
// the inline cache export of nydus image is disabled here.
return nil, errors.Errorf("inline cache with %s compression is unsupported", compressionopt.Type)
}

workerRef, ok := res.Sys().(*worker.WorkerRef)
if !ok {
return nil, errors.Errorf("invalid reference: %T", res.Sys())
Expand Down

0 comments on commit a9362be

Please sign in to comment.