for-win
for-win copied to clipboard
Bash completions not working in WSL in Docker Desktop 4.27.0+
Description
Upon upgrading to 4.27.0 (and persisting through 4.27.2), Bash command line completions have stopped working.
Reproduce
- Open WSL prompt.
- Type
docker
. - Press <tab>.
Expected behavior
Pressing <tab> should show Docker-specific subcommands and options, not a list of files and directories in the current directory.
docker version
Client:
Cloud integration: v1.0.35+desktop.10
Version: 25.0.3
API version: 1.44
Go version: go1.21.6
Git commit: 4debf41
Built: Tue Feb 6 21:13:00 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Desktop
Engine:
Version: 25.0.3
API version: 1.44 (minimum version 1.24)
Go version: go1.21.6
Git commit: f417435
Built: Tue Feb 6 21:14:25 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.28
GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
Client:
Version: 25.0.3
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.12.1-desktop.4
Path: /usr/local/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.24.5-desktop.1
Path: /usr/local/lib/docker/cli-plugins/docker-compose
debug: Get a shell into any image or container. (Docker Inc.)
Version: 0.0.24
Path: /usr/local/lib/docker/cli-plugins/docker-debug
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.0
Path: /usr/local/lib/docker/cli-plugins/docker-dev
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.21
Path: /usr/local/lib/docker/cli-plugins/docker-extension
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.4
Path: /usr/local/lib/docker/cli-plugins/docker-feedback
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.0.0
Path: /usr/local/lib/docker/cli-plugins/docker-init
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: /usr/local/lib/docker/cli-plugins/docker-sbom
scout: Docker Scout (Docker Inc.)
Version: v1.4.1
Path: /usr/local/lib/docker/cli-plugins/docker-scout
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 25.0.3
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
Kernel Version: 5.15.133.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 19.25GiB
Name: docker-desktop
ID: 305a53a9-bac9-42fb-a303-b6f17bb0883c
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false
Diagnostics ID
0055270B-08E7-4730-B86A-EC5C8BD8B4BC/20240210220950
Additional Info
I still have a /usr/share/bash-completion/completions/docker
file, which is a symlink to /mnt/wsl/docker-desktop/cli-tools/usr/share/bash-completion/completions/docker
, but the entire /mnt/wsl/docker-desktop/cli-tools/usr/share
directory does not exist. /mnt/wsl/docker-desktop/cli-tools/usr
only contains bin
and local
.
Same with zsh, you get compinit:503: no such file or directory: /usr/share/zsh/vendor-completions/_docker
due to the now broken symlink
+1
+1
+1
+1
Having the same issue:
4.28.0 released but still no fix...
Same issue, on start zsh
:
compinit:503: no such file or directory: /usr/share/zsh/vendor-completions/_docker
There is a link to a missing file
❯ ls -lah /usr/share/zsh/vendor-completions/_docker
lrwxrwxrwx 1 root root 74 Feb 17 18:16 /usr/share/zsh/vendor-completions/_docker -> /mnt/wsl/docker-desktop/cli-tools/usr/share/zsh/vendor-completions/_docker
❯ ls -lah /mnt/wsl/docker-desktop/cli-tools/usr/share/zsh/vendor-completions/_docker
ls: cannot access '/mnt/wsl/docker-desktop/cli-tools/usr/share/zsh/vendor-completions/_docker': No such file or directory
So the actual missing file is /mnt/wsl/docker-desktop/cli-tools/usr/share/zsh/vendor-completions/_docker
Same issue, on start
zsh
:compinit:503: no such file or directory: /usr/share/zsh/vendor-completions/_docker
There is a link to a missing file
❯ ls -lah /usr/share/zsh/vendor-completions/_docker lrwxrwxrwx 1 root root 74 Feb 17 18:16 /usr/share/zsh/vendor-completions/_docker -> /mnt/wsl/docker-desktop/cli-tools/usr/share/zsh/vendor-completions/_docker ❯ ls -lah /mnt/wsl/docker-desktop/cli-tools/usr/share/zsh/vendor-completions/_docker ls: cannot access '/mnt/wsl/docker-desktop/cli-tools/usr/share/zsh/vendor-completions/_docker': No such file or directory
So the actual missing file is
/mnt/wsl/docker-desktop/cli-tools/usr/share/zsh/vendor-completions/_docker
Exactly same issue here:
compinit:503: no such file or directory: /usr/share/zsh/vendor-completions/_docker
Yes, same for me in Debian WSL2.
I noticed that Docker autocompletion stopped working out of nowhere and after investigating I can confirm the issue is the same for me, the /mnt/wsl/docker-desktop/cli-tools/usr/share
directory is missing:
$ ls -la /usr/share/bash-completion/completions/docker
lrwxrwxrwx 1 root root 78 Jan 18 22:26 /usr/share/bash-completion/completions/docker -> /mnt/wsl/docker-desktop/cli-tools/usr/share/bash-completion/completions/docker
$ stat -L /usr/share/bash-completion/completions/docker
stat: cannot statx '/usr/share/bash-completion/completions/docker': No such file or directory
$ ls -la /mnt/wsl/docker-desktop/cli-tools/usr/
total 8
drwxr-xr-x 4 root root 2048 Feb 19 10:23 .
drwxr-xr-x 3 root root 2048 Feb 19 10:23 ..
drwxr-xr-x 2 root root 2048 Feb 19 10:23 bin
drwxr-xr-x 4 root root 2048 Feb 19 10:23 local
temporally workaround found here https://gist.github.com/ro31337/b2c33ad0b90636e9e3bb76fb4fb76907
Still broken in 4.29.0.
Temporary workaround. Generate a completion file with docker completion SHELL
.
bash:
docker completion bash > ~/.local/share/bash-completion/completions/docker.bash
FYI there is work internally at Docker happening in this area. Thanks for your patience.
Fix planned for Desktop 4.30 in a couple of weeks
Works in 4.30 for me in combination with zsh.
Can also confirm it works on my computer with 4.30 and zsh. Thanks for fixing!
Closing this issue as it's fixed with 4.30. Thanks again for your patience!