First install lima:
brew install lima
After installing lima, you can create a Linux VM on Mac using:
limactl create default
It will create a Ubuntu debian machine on MacOS. If you want to create a docker server, use docker.yaml file and create a new machine.
limactl start docker.yaml
The script will output few commands to set docker context to this newly created server. Run first two commands, and you have a working docker installation.