MCPcopy Index your code
hub / github.com/linuxkit/linuxkit / cachePushCmd

Function cachePushCmd

src/cmd/linuxkit/cache_push.go:10–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8)
9
10func cachePushCmd() *cobra.Command {
11 var (
12 remoteName string
13 pushArchSpecificTags bool
14 override bool
15 )
16 cmd := &cobra.Command{
17 Use: "push",
18 Short: "push images from the linuxkit cache",
19 Long: `Push named images from the linuxkit cache to registry. Can provide short name, like linuxkit/kernel:6.6.13
20 or nginx, or canonical name, like docker.io/library/nginx:latest.
21 It is efficient, as blobs with the same content are not replaced.`,
22 Args: cobra.MinimumNArgs(1),
23 RunE: func(cmd *cobra.Command, args []string) error {
24 names := args
25 for _, name := range names {
26 fullname := util.ReferenceExpand(name)
27
28 p, err := cachepkg.NewProvider(cacheDir)
29 if err != nil {
30 log.Fatalf("unable to read a local cache: %v", err)
31 }
32
33 if err := p.Push(fullname, remoteName, pushArchSpecificTags, override); err != nil {
34 log.Fatalf("unable to push image named %s: %v", name, err)
35 }
36 }
37 return nil
38 },
39 }
40 cmd.Flags().StringVar(&remoteName, "remote-name", "", "Push it under a different name, e.g. push local image foo/bar:mine as baz/bee:yours. If blank, uses same local name.")
41 cmd.Flags().BoolVar(&pushArchSpecificTags, "with-arch-tags", false, "When the local reference is an index, add to the remote arch-specific tags for each arch in the index, each as their own tag with the same name as the index, but with the architecture appended, e.g. image:foo will have image:foo-amd64, image:foo-arm64, etc.")
42 cmd.Flags().BoolVar(&override, "override", false, "Even if the image already exists in the registry, push it again, overwriting the existing image.")
43 return cmd
44}

Callers 1

cacheCmdFunction · 0.85

Calls 1

PushMethod · 0.95

Tested by

no test coverage detected