MCPcopy Index your code
hub / github.com/docker/cli / runCreate

Function runCreate

cli/command/plugin/create.go:90–123  ·  view source on GitHub ↗
(ctx context.Context, dockerCli command.Cli, options pluginCreateOptions)

Source from the content-addressed store, hash-verified

88}
89
90func runCreate(ctx context.Context, dockerCli command.Cli, options pluginCreateOptions) error {
91 if err := validateTag(options.repoName); err != nil {
92 return err
93 }
94
95 absContextDir, err := validateContextDir(options.context)
96 if err != nil {
97 return err
98 }
99
100 if err := validateConfig(options.context); err != nil {
101 return err
102 }
103
104 comp := compression.None
105 if options.compress {
106 logrus.Debugf("compression enabled")
107 comp = compression.Gzip
108 }
109
110 createCtx, err := archive.TarWithOptions(absContextDir, &archive.TarOptions{
111 Compression: comp,
112 })
113 if err != nil {
114 return err
115 }
116
117 _, err = dockerCli.Client().PluginCreate(ctx, createCtx, client.PluginCreateOptions{RepoName: options.repoName})
118 if err != nil {
119 return err
120 }
121 _, _ = fmt.Fprintln(dockerCli.Out(), options.repoName)
122 return nil
123}

Callers 1

newCreateCommandFunction · 0.70

Calls 6

validateContextDirFunction · 0.85
PluginCreateMethod · 0.80
validateTagFunction · 0.70
validateConfigFunction · 0.70
ClientMethod · 0.65
OutMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…