This solution can also be used to move from raw format back to qcow2 format.

I used to have Docker on MacOS Sierra, which created the image files using the qcow2 format. Then I upgraded to Yosemite, but due to a disk failure of the external SSD that has the qcow2 images file, it created a raw format image file (for more see this one: https://docs.docker.com/docker-for-mac/faqs/#qcow2-or-raw)

This shouldn’t be a problem in general, but in my case I use it for development purposes and I still have uncommitted images. Also using the Docker Preferences GUI I can only select the directory, not the actual file. Solution is pretty simple:

Navigate. to:

~/Library/Group\ Containers/group.com.docker/settings.json

and change the diskPath file to the qcow2 file. That should do it.