I don’t want to use Docker Desktop to run containers on my Mac. I also want to run Kubernetes stuff and I want to use a more CLI oriented tool.
A Solution: minikube
I’ve been using minikube for a while now, it’s worked perfectly as a means to run containers on my Mac. As a bonus you can also run Kubernetes pods :D
It’s 99% identical to running Docker Desktop (it runs a VM and your
docker commands act on that VM). The only real difference is in my setup I don’t run any kind of
localhost proxy, so you connect to the VM’s IP instead of localhost for accessing services.
Uninstall Docker Desktop if you have it.
Unset any docker env vars except for
DOCKER_BUILDKIT=1(if you have that set)
brew install docker minikube(the docker here is the CLI tool, not the full stack)
This will take quite a while the first time but should result in a working minikube (with your config pointing to it).
minikube docker-envto get instructions for setting up Docker to point to minikube. Typically this is a bunch of environment variables to set in your shell.
docker run hello-world
Optional Extra: Using VirtualBox
I like to use VirtualBox instead of the default driver. One reason is I more easily peak into the VM and another is to work around macos hyperkit NAT mode network (VPN share issue) #273 which screws up talking to my work VPN.
brew install docker minikubelike above.
Install VirtualBox from https://www.virtualbox.org
Do not install the VirtualBox extensions if prompted, they’re not needed for this and they require a licence for commercial use.
Why install directly instead of via Homebrew? It’s the kernel extension, every time homebrew updates VirtualBox it breaks your minikube until you reboot. I find it easier (and less annoying) to upgrade more slowly by hand.
minikube stopif you’ve it before reading about this Virtualbox option.
minikube deleteto expunge the previous setup.
Reconfigure minikube to use VirtualBox instead:
minikube config set driver virtualbox minikube config set cpus 2 minikube config set disk-size 60GB # Disk space for all those docker builds! minikube config set memory 8192 # Good on a 16GB or 32GB machine
You may need to run
minikube docker-envagain to reconfigure your settings
minikube ipto locate the IP services listen on.
docker run --rm -it -p 6379:6379 rediswill wind up listening on
You can also run podman with this setup, which is ideal for trying it out.
To set it up use
brew install podman and