Install minikube on an Apple Sillicon without Docker Desktop

minikube docker colima apple M1 arm64 apple sillicon

4 min read | by Jordi Prats

If you try to install minikube on an Apple Sillicon (such as Apple M1, M2...) you will face that some hypervisors doesn't support arm64 yet. Using Docker Destop, on the other hand, has recently changed it's license so it might not be suitable to you

$ minikube start
πŸ˜„  minikube v1.26.1 on Darwin 12.5.1 (arm64)
✨  Automatically selected the parallels driver. Other choices: ssh, qemu2 (experimental)

❌  Exiting due to DRV_UNSUPPORTED_OS: The driver 'parallels' is not supported on darwin/arm64

$ minikube start --driver docker
πŸ˜„  minikube v1.26.1 on Darwin 12.5.1 (arm64)
✨  Using the docker driver based on user configuration

πŸ’£  Exiting due to PROVIDER_DOCKER_NOT_RUNNING: "docker version --format -" exit status 1: Cannot connect to the Docker daemon at unix:///Users/jordiprats/.rd/docker.sock. Is the docker daemon running?
πŸ’‘  Suggestion: Start the Docker service
πŸ“˜  Documentation: https://minikube.sigs.k8s.io/docs/drivers/docker/

There are several alternatives to Docker Desktop but the one that I found more convenient and easier to install is Colima

Let's start by installing minikube using brew:

brew install minikube

We'll need to install docker cli (that's not the daemon) and docker-compose:

brew install docker docker-compose

At the end of the installation log you'll find two commands do run:

$ brew install docker docker-compose
(...)
==> docker-compose
Compose is now a Docker plugin. For Docker to find this plugin, symlink it:
  mkdir -p ~/.docker/cli-plugins
  ln -sfn /opt/homebrew/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose

Make sure you run them before proceeding:

mkdir -p ~/.docker/cli-plugins
ln -sfn /opt/homebrew/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose

At this point we'll have the docker command but it won't be any daemon to actually run containers:

$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

To install the daemon to run the containers we'll use colima. We can install it using brew as well:

brew install colima

It's going to take a while, but once installed we'll be able to start the daemon using colima start:

$ colima start
INFO[0000] starting colima
INFO[0000] runtime: docker
INFO[0000] preparing network ...                         context=vm
INFO[0000] creating and starting ...                     context=vm
INFO[0036] provisioning ...                              context=docker
INFO[0036] starting ...                                  context=docker
INFO[0042] done

By default it limits the VM to 2 GB, so if you need more resources you can use the -m flag to be able to use more memory (in Gigabytes):

$ colima start -m 4

Using colima list we check whether is running:

$ colima list
PROFILE    STATUS     ARCH       CPUS    MEMORY    DISK     RUNTIME    ADDRESS
default    Running    aarch64    2       4GiB      60GiB    docker

Once it is running we can check with docker ps that it can connect to the daemon:

$ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

At this point we can now use minikube with the docker driver. So we need to make sure it is configured:

$ minikube config set driver docker

After this we can use minikube start as usual:

$ minikube  start
πŸ˜„  minikube v1.26.1 on Darwin 12.5.1 (arm64)
✨  Using the docker driver based on user configuration
πŸ“Œ  Using Docker Desktop driver with root privileges
πŸ‘  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
πŸ’Ύ  Downloading Kubernetes v1.24.3 preload ...
(...)
🌟  Enabled addons: storage-provisioner, default-storageclass
πŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

With docker ps we'll see how it is using it to run the nodes:

$ docker ps
CONTAINER ID   IMAGE                    COMMAND                  CREATED         STATUS         PORTS                                                                                                                                                                                                                           NAMES
0c2362e99f10   kicbase/stable:v0.0.33   "/usr/local/bin/entr…"   4 minutes ago   Up 4 minutes   0.0.0.0:49157->22/tcp, :::49157->22/tcp, 0.0.0.0:49156->2376/tcp, :::49156->2376/tcp, 0.0.0.0:49155->5000/tcp, :::49155->5000/tcp, 0.0.0.0:49154->8443/tcp, :::49154->8443/tcp, 0.0.0.0:49153->32443/tcp, :::49153->32443/tcp   minikube
$ kubectl get nodes
NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   62m   v1.24.3

Posted on 14/09/2022