After changing your MacOS username, you might encounter issues with Docker Desktop not starting properly. This is often due to Docker’s internal paths still referencing the old username.
The “Docker Desktop encountered an unexpected error and needs to close” message when starting Docker Desktop may reference the old path, and a “permission denied” error. For example:
running engine: waiting for the VM setup to be ready: preparing VM:
creating disk folder /Users/{old_username}/Library/Containers/com.docker.docker/Data/vms/0/data:
mkdir /Users/{old_username}: permission denied
On MacOS, you need to edit the ~/Library/Group\ Containers/group.com.docker/settings-store.json file to update the paths - in my case it was the DataFolder path that needed updating.
{
...
"DataFolder": "/Users/{new_username}/Library/Containers/com.docker.docker/Data/vms/0/data",
...
}
After updating the path(s) in this file to reflect your new username, save the file and restart Docker Desktop. It should now start without issues.
Keeping this post for the inevitable future when I change my name again...