Replacing Docker Desktop with Lima on Mac OS

·

1 min read

As Docker Desktop is no longer free to use, I spent my workday trying alternatives and setup Lima on Big Sur. Here are my notes that I will probably end up googling myself at some point :D

brew install docker
brew install docker-compose
brew install lima
limactl start

*If limactl isn't found, start a new terminal.

Press enter to start with the default configuration.

Download Lima's docker.yaml

limactl start ./docker.yaml
docker context create lima --docker "host=unix://{{.Dir}}/sock/docker.sock"
docker context use lima

You should now be able to run docker or docker-compose!

By default Lima mounts volumes as readonly.

I wasn't done yet, as I needed writable volumes in my projects that were all under ~/Code. We can modify the config that lima is using.

First stop the lima vm.

limactl stop docker

Edit ~/.lima/docker/lima.yaml, I threw in my Code folder as a writable mount:

mounts:
- location: "~"
- location: "~/Code"
  writable: true
- location: "/tmp/lima"
  writable: true

Start the lima vm.

limactl start docker

Notes:

*If you see the error error getting credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH In ~/.docker/config.json change credsStore to credStore

*You shouldn't need to set this, but if you need the env var DOCKER_HOST

export DOCKER_HOST=$(limactl list docker --format 'unix://{{.Dir}}/sock/docker.sock')