Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shell completion: unfriendly docker cp completion #3040

Open
brandon1024 opened this issue Apr 4, 2021 · 0 comments
Open

shell completion: unfriendly docker cp completion #3040

brandon1024 opened this issue Apr 4, 2021 · 0 comments

Comments

@brandon1024
Copy link

brandon1024 commented Apr 4, 2021

Description

Shell completion for docker cp has a few usability issues that make completing file paths quite frustrating.

1. Host File Path Tilde Expansion
When trying to copy files to or from the host, the shell completion script neglects to expand tildes. Ideally docker cp completion would work similar to shell builtins like cp, where typing docker cp ~ and tabbing for completion results would show files/directories in my home directory.

2. Container Path Completion
Shell completion for docker cp does not provide completion results for files on the container.

I could see this as being a bit more tricky to fix, I'm not even sure how you'd do it.

3. Default Copy Location
When copying files to a container, if no destination is provided (e.g. docker cp myfile container:), files should be copied to the location indicated by the first WORKDIR directive. scp behaves in this way; when no destination is provided the file is uploaded to $HOME.

Steps to reproduce the issue:

  1. Type docker cp ~ in your shell and tab for completion results.
  2. Create a file in your CWD named 'test-file'.
  3. Start (any) container by running docker run --rm -d --name "docker_cp_test" debian:latest tail -F /dev/null
  4. Type docker cp test-file docker_cp_test: in your shell and tab for completion results.

Describe the results you received:
No completion results are shown for files/directories in my home directory. Additionally, docker does not provide shell completion results for files/directories in the container.

Describe the results you expected:
I expect the that completion results are shown for files/directories in my home directory. Docker should provide shell completion results for files/directories in the container.

Output of docker version:

Client: Docker Engine - Community
 Version:           20.10.5
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:17:50 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          19.03.14
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       5eb3275d40
  Built:            Tue Dec  1 19:18:50 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)

Server:
 Containers: 5
  Running: 5
  Paused: 0
  Stopped: 0
 Images: 69
 Server Version: 19.03.14
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.7.0-0.bpo.2-amd64
 Operating System: Debian GNU/Linux 10 (buster)
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 62.63GiB
 Name: md2qhqqc
 ID: IPZA:DVYZ:OLTM:MKZ6:NLC3:CQGZ:HXNV:JAK7:PVGD:WIO7:FFLA:YMAA
 Docker Root Dir: /home/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants