How to get Docker Desktop on Mac to point to new location of VM Image?

1k views Asked by At

Docker Desktop supports moving the VM Image that it uses onto another drive if needed. On my Mac Mini (2018) I have moved it to an external SSD in order to enlarge it more than the internal storage would have allowed.

The external SSD was named "Extra Space", which (ironically) became a problem when I also tried to use the SSD for other non-Docker development and discovered that some of the Ruby Gems I am using have problems with spaces in path names.

I decided that I would have to rename the drive to "ExtraSpace" (without the "extra" space), but then Docker was not able to find its VM Image. I was unable to use the built-in location chooser ("Preferences" -> "Resources" -> "Advanced" -> "Disk Image Location") because that tool assumes that it is moving the image from one location to another but in my case the image is not being moved, only the path to the existing image is changing.

I looked through the Docker configuration in ~/Library/Containers/com.docker.desktop/ and found the path to the image in Library/Containers/com.docker.docker/Data/vms/0/hyperkit.json. I tried changing it there, but Docker Desktop would not start.

In the error logs, I found lots of messages like this:

time="2021-10-31T15:06:43-04:00" level=error msg="(5487d9bc) 4ecbf40e-BackendAPI S->C f68f0c84-DriverCMD GET /vm/disk (925.402µs): mkdir /Volumes/Extra Space: permission denied"
common/cmd/com.docker.backend/internal/handlers.(*VMInitHandler).VMDiskInfo(0x58c13b8, {0x58b94a0, 0xc0001d82a0})
    common/cmd/com.docker.backend/internal/handlers/vminit.go:39 +0x42

Why does Docker Desktop not follow the VM configuration file to find the location of the image? Is there somewhere else I have to change it?

1

There are 1 answers

0
Moshe Katz On BEST ANSWER

After a lot more searching, I found the following additional files that need to be updated with the new path:

  • ~/Library/Preferences/com.electron.docker-frontend.plist
  • ~/Library/Preferences/com.electron.dockerdesktop.plist
  • ~/Library/Group Containers/group.com.docker/settings.json

Once I had updated all of these files with the new path, Docker Desktop was able to start up correctly.