MCPcopy Create free account
hub / github.com/containerd/nerdctl / prepareImageStore

Function prepareImageStore

pkg/imgutil/transfer.go:42–63  ·  view source on GitHub ↗
(ctx context.Context, parsedReference *referenceutil.ImageReference, options types.ImagePullOptions)

Source from the content-addressed store, hash-verified

40)
41
42func prepareImageStore(ctx context.Context, parsedReference *referenceutil.ImageReference, options types.ImagePullOptions) (*transferimage.Store, error) {
43 var storeOpts []transferimage.StoreOpt
44 if len(options.OCISpecPlatform) > 0 {
45 storeOpts = append(storeOpts, transferimage.WithPlatforms(options.OCISpecPlatform...))
46 }
47
48 unpackEnabled := len(options.OCISpecPlatform) == 1
49 if options.Unpack != nil {
50 unpackEnabled = *options.Unpack
51 if unpackEnabled && len(options.OCISpecPlatform) != 1 {
52 return nil, fmt.Errorf("unpacking requires a single platform to be specified (e.g., --platform=amd64)")
53 }
54 }
55
56 if unpackEnabled {
57 platform := options.OCISpecPlatform[0]
58 snapshotter := options.GOptions.Snapshotter
59 storeOpts = append(storeOpts, transferimage.WithUnpack(platform, snapshotter))
60 }
61
62 return transferimage.NewStore(parsedReference.String(), storeOpts...), nil
63}
64
65func createOCIRegistry(ctx context.Context, parsedReference *referenceutil.ImageReference, gOptions types.GlobalCommandOptions, plainHTTP bool) (*registry.OCIRegistry, func(), error) {
66 ch, err := dockerconfigresolver.NewCredentialHelper(parsedReference.Domain)

Callers 1

PullImageWithTransferFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…