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

Function runCopy

cli/command/container/cp.go:215–247  ·  view source on GitHub ↗
(ctx context.Context, dockerCli command.Cli, opts copyOptions)

Source from the content-addressed store, hash-verified

213}
214
215func runCopy(ctx context.Context, dockerCli command.Cli, opts copyOptions) error {
216 srcContainer, srcPath := splitCpArg(opts.source)
217 destContainer, destPath := splitCpArg(opts.destination)
218
219 copyConfig := cpConfig{
220 followLink: opts.followLink,
221 copyUIDGID: opts.copyUIDGID,
222 quiet: opts.quiet,
223 sourcePath: srcPath,
224 destPath: destPath,
225 }
226
227 var direction copyDirection
228 if srcContainer != "" {
229 direction |= fromContainer
230 copyConfig.container = srcContainer
231 }
232 if destContainer != "" {
233 direction |= toContainer
234 copyConfig.container = destContainer
235 }
236
237 switch direction {
238 case fromContainer:
239 return copyFromContainer(ctx, dockerCli, copyConfig)
240 case toContainer:
241 return copyToContainer(ctx, dockerCli, copyConfig)
242 case acrossContainers:
243 return errors.New("copying between containers is not supported")
244 default:
245 return errors.New("must specify at least one container source")
246 }
247}
248
249func resolveLocalPath(localPath string) (absPath string, _ error) {
250 absPath, err := filepath.Abs(localPath)

Calls 3

splitCpArgFunction · 0.85
copyFromContainerFunction · 0.85
copyToContainerFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…