MCPcopy Create free account
hub / github.com/docker/cli / createManifestList

Function createManifestList

cli/command/manifest/create_list.go:38–76  ·  view source on GitHub ↗
(ctx context.Context, dockerCLI command.Cli, args []string, opts createOpts)

Source from the content-addressed store, hash-verified

36}
37
38func createManifestList(ctx context.Context, dockerCLI command.Cli, args []string, opts createOpts) error {
39 newRef := args[0]
40 targetRef, err := normalizeReference(newRef)
41 if err != nil {
42 return fmt.Errorf("error parsing name for manifest list %s: %w", newRef, err)
43 }
44
45 manifestStore := newManifestStore(dockerCLI)
46 _, err = manifestStore.GetList(targetRef)
47 switch {
48 case errdefs.IsNotFound(err):
49 // New manifest list
50 case err != nil:
51 return err
52 case !opts.amend:
53 return errors.New("refusing to amend an existing manifest list with no --amend flag")
54 }
55
56 // Now create the local manifest list transaction by looking up the manifest schemas
57 // for the constituent images:
58 manifests := args[1:]
59 for _, manifestRef := range manifests {
60 namedRef, err := normalizeReference(manifestRef)
61 if err != nil {
62 // TODO: wrap error?
63 return err
64 }
65
66 manifest, err := getManifest(ctx, dockerCLI, targetRef, namedRef, opts.insecure)
67 if err != nil {
68 return err
69 }
70 if err := manifestStore.Save(targetRef, namedRef, manifest); err != nil {
71 return err
72 }
73 }
74 _, _ = fmt.Fprintln(dockerCLI.Out(), "Created manifest list", targetRef.String())
75 return nil
76}

Callers 1

newCreateListCommandFunction · 0.85

Calls 7

normalizeReferenceFunction · 0.85
newManifestStoreFunction · 0.85
getManifestFunction · 0.70
GetListMethod · 0.65
SaveMethod · 0.65
OutMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…