for-mac icon indicating copy to clipboard operation
for-mac copied to clipboard

Docker Desktop for Mac - Configure shell completions does not work if .zshrc file does not exist

Open focher opened this issue 9 months ago • 4 comments

Description

When attempting to use the "Configure shell completions" under the Settings in Docker Desktop on macOS, and error occurs and a message informing of insufficient permissions.

If the ~/.zshrc file does not exist then the option will fail with the non-relevant message.

Reproduce

Under Settings - General and the "Configure shell completions" section, click the Install button to add the shell configuration commands. Receive error that the user or application does not have permission to make the changes.

Expected behavior

Docker Desktop should create a new ~/.zshrc file with appropriate contents if no file already exists, then properly incorporate the configuration commands for the CLI.

docker version

Client:
 Version:           28.0.1
 API version:       1.48
 Go version:        go1.23.6
 Git commit:        068a01e
 Built:             Wed Feb 26 10:38:16 2025
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.39.0 (184744)
 Engine:
  Version:          28.0.1
  API version:      1.48 (minimum version 1.24)
  Go version:       go1.23.6
  Git commit:       bbd0a17
  Built:            Wed Feb 26 10:40:57 2025
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.7.25
  GitCommit:        bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc:
  Version:          1.2.4
  GitCommit:        v1.2.4-0-g6c52b3f
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client:
 Version:    28.0.1
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  ai: Docker AI Agent - Ask Gordon (Docker Inc.)
    Version:  v0.9.4
    Path:     /Users/macminiserver/.docker/cli-plugins/docker-ai
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.21.1-desktop.2
    Path:     /Users/macminiserver/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.33.1-desktop.1
    Path:     /Users/macminiserver/.docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.38
    Path:     /Users/macminiserver/.docker/cli-plugins/docker-debug
  desktop: Docker Desktop commands (Beta) (Docker Inc.)
    Version:  v0.1.5
    Path:     /Users/macminiserver/.docker/cli-plugins/docker-desktop
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.2
    Path:     /Users/macminiserver/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.27
    Path:     /Users/macminiserver/.docker/cli-plugins/docker-extension
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.5
    Path:     /Users/macminiserver/.docker/cli-plugins/docker-feedback
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.4.0
    Path:     /Users/macminiserver/.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:     /Users/macminiserver/.docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.16.3
    Path:     /Users/macminiserver/.docker/cli-plugins/docker-scout

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 28.0.1
 Storage Driver: overlayfs
  driver-type: io.containerd.snapshotter.v1
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc version: v1.2.4-0-g6c52b3f
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
  cgroupns
 Kernel Version: 6.10.14-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 10
 Total Memory: 7.654GiB
 Name: docker-desktop
 ID: c640850e-2055-4d4d-bf39-e4f70dbdf35b
 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
 Labels:
  com.docker.desktop.address=unix:///Users/macminiserver/Library/Containers/com.docker.docker/Data/docker-cli.sock
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Diagnostics ID

FD86C3D0-150B-4F6C-A97A-9A993CFAF81A/20250306002053

Additional Info

The workaround is to Open a Terminal session and create a blank one line file under ~/.zshrc. Retry the Install under the Settings for "Configure shell completions". Docker Desktop now reports it successfully detected and add the appropriate lines to the ~/.zshrc file.

focher avatar Mar 06 '25 00:03 focher

@focher Is your home directory owned by you or by root? You can see it by running ls -lh inside your home directory.

Benehiko avatar Mar 06 '25 11:03 Benehiko

@focher Is your home directory owned by you or by root? You can see it by running ls -lh inside your home directory.

It’s owned by me, the logged in user running Docker Desktop. User is “macminiserver” and here’s the output.

macminiserver@Macs-Mac-mini ~ % ls -lh total 0 drwx------+ 5 macminiserver staff 160B Mar 5 23:04 Desktop #drwx------+ 5 macminiserver staff 160B Mar 5 23:14 Documents drwx------+ 7 macminiserver staff 224B Mar 5 23:05 Downloads drwx------@ 82 macminiserver staff 2.6K Mar 5 23:10 Library drwx------ 4 macminiserver staff 128B Mar 5 07:43 Movies drwx------+ 4 macminiserver staff 128B Mar 5 22:17 Music drwx------+ 4 macminiserver staff 128B Mar 4 10:30 Pictures drwxr-xr-x+ 4 macminiserver staff 128B Mar 4 10:29 Public macminiserver@Macs-Mac-mini ~ %

It’s pretty much straight out of the box.

focher avatar Mar 06 '25 14:03 focher

Yes you're right, I checked the code again and it looks like we don't create the file.

To get the installation going, create the file and try the install again.

touch `~/.zshrc`

Benehiko avatar Mar 06 '25 16:03 Benehiko

Yes you're right, I checked the code again and it looks like we don't create the file.

To get the installation going, create the file and try the install again.

touch ~/.zshrc

Thanks. I had done something similar by just creating a blank one line ~/.zshrc file. Then the option in the GUI worked fine.

focher avatar Mar 06 '25 16:03 focher