(ctx context.Context, dockerCli command.Cli, opts copyOptions)
| 213 | } |
| 214 | |
| 215 | func 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 | |
| 249 | func resolveLocalPath(localPath string) (absPath string, _ error) { |
| 250 | absPath, err := filepath.Abs(localPath) |
searching dependent graphs…