Skip to content

Add docker cp equivalent in Files panel #71

@GustavoCaso

Description

@GustavoCaso

Summary

Enable copying files between a container and the host filesystem from within the Files panel, equivalent to docker cp.

Current State

  • The Files panel (internal/ui/sections/containers/panel/filetree_panel.go) shows the container filesystem as a browsable tree
  • Files can be browsed but not copied to/from the host

Implementation Steps

1. Add client interface methods

In internal/client/client.go, add to ContainerService:

CopyFromContainer(ctx context.Context, containerID, srcPath string) (io.ReadCloser, error)
CopyToContainer(ctx context.Context, containerID, dstPath string, content io.Reader) error

2. Implement in Docker client

Use client.CopyFromContainer and client.CopyToContainer. The Docker API returns/accepts a tar stream.

3. Copy from container to host

  • Add key binding (e.g. c) in the Files panel when a file is highlighted
  • Prompt user for destination path on the host (default: current working directory)
  • Extract the tar stream to the destination
  • Show success/error banner with the file path written

4. Copy from host to container

  • Add key binding (e.g. u for upload) in the Files panel
  • Prompt user for the source file path on the host
  • Prompt for destination directory in the container (default: current directory in tree)
  • Tar the file and send via CopyToContainer
  • Refresh the file tree after upload

5. Progress indicator

Show a spinner with filename during copy operations.

Acceptance Criteria

  • Pressing c on a selected file copies it to a host directory
  • Pressing u uploads a host file to the current container directory
  • Destination path is user-configurable with a sensible default
  • Large files show a progress/spinner indicator
  • File tree refreshes after upload
  • Error shown if path does not exist or permissions are denied

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestp2High value, more involved

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions