using colima to run docker on a mac

10 Oct 2023

Install docker / docker-compose

$ brew install docker
$ brew install docker-compose
$ docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Install colima

$ brew install colima

Configure colima

Cannot chown or chmod bind mounted files/dirs

$ cat $HOME/.colima/_lima/_config/override.yaml
mountType: 9p
mounts:
  - location: "/Users/jlopez"
    writable: true
    9p:
      securityModel: mapped-xattr
      cache: mmap
  - location: "~"
    writable: true
    9p:
      securityModel: mapped-xattr
      cache: mmap
  - location: /tmp/colima
    writable: true
    9p:
      securityModel: mapped-xattr
      cache: mmap

Use colima

$ colima start --mount-type 9p --vm-type qemu #or colima start --cpu 4 --memory 8 --mount-type 9p --vm-type qemu
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
70f5ac315c5a: Pull complete
...

Happy hacking! 😊