Docker desktop and minikube are popular options for local development. Do you need both installed for local development or can you save some RAM and run a only one of them. Below are some questions to help you decide which one to use in your situation.
Which version of Kubernetes are you running in production?
Kuberenets (k8s) is on a three month release cycle with an N-2 support policy. For example in July 2020 k8s 1.18 is the most recent GA release, 1.17 and 1.16 are currently supported. When k8s 1.19 is released 1.16 will fall out of support. Many organizations run the oldest supported k8s to minimize risk to production systems.
Docker Desktop includes a hard coded version of Kubernetes. For example at time of writing the most recent Docker desktop includes k8s 1.16.5 since that is the oldest supported version of k8s.
Currently it is not possible to change the version of k8s in Docker desktop. If you need an older version of k8s you will have to install an older version of Docker desktop. Basically Docker is shipping the “most stable, widely used” version of k8s since many organizations run the oldest GA version of k8s in production.
Minikube supports the most recent GA version of k8s plus the previous 6 minor versions. You can pass minikube a command line argument to launch a specific version of k8s. For example,
minikube start --kubernetes-version=v1.18.3 will launch k8s 1.18.3
How do you build your container images?
If you use a
Dockerfile during development you will need to have Docker desktop installed, otherwise you won’t be able to run
docker build to create a container image on your laptop.
If you are building your container image using tools such as JIB that don’t require a local Docker daemon you can run minikube without Docker desktop.
Do you need a local container registry?
Minikube does not ship with a container registry. By default it will try to resolve container images from Docker hub and other public registries. If you need to build containers on your laptop and you want minikube to pull them form your laptop rather than a remote container registry you will benefit from running Docker desktop since it includes a local container registry.
How do you manage local development dependencies?
If your application depends on commonly used OSS databases, message queues, caches you will have to decide how setup these dependencies on your laptop. There are three reasonable choices.
- Install on laptop
- Run with docker-compose
- Run on minikube
Installing directly on a laptop can be time consuming and error prone. If you work on multiple apps or services that need different versions of PostgreSQL or MySQL then development becomes more time consuming and error prone.
You can run dependencies using docker-compose which has a nice developer friendly workflow.
- checkout code
- write code / run tests on laptop that use services running in Docker
With docker-compose we are running third party dependencies in simple repeatable manner.
Minikube can also be used to run third party dependencies such as MySQL and other tools. To do so you will have to write k8s deployment manifests and expose the services using a NodePort on the minikube vm ip address.
If you want to use docker-compose for dependencies then you will need docker desktop, otherwise you can get away with minikube.
Are you using JUNIT with test containers ?
If you are using the test containers project for your automated testing you will need to run Docker Desktop since test containers does not currently support Kubernetes.
Which Operating System are you using for local development?
Docker Desktop is available on MacOS and Windows and it includes both k8s and docker . On Linux the docker distribution only includes docker, so you will have to install k8s from another source.
Minikube is available on Mac, Windows, and Linux. If you are looking for the same developer experience across Mac, Windows, and Linux then minikube is a good choice.
Use docker desktop if
- You need to build container images from
- You need a local container registry
- You are managing your local development environment with docker compose
- You are using test containers with junit
- The version of Kubernetes included in docker desktop is the version you want to use
- Your developers are only on MacOS and Windows.
Use minikube if
- You need to pick a specific version of Kubernetes to work with
- You don’t need a local container registry
- You are not using test containers with junit
- You have developers using Linux, MacOS, and Windows
Based on your answers to the question above it is quite possible that you will need to run both.
3 thoughts on “Minikube vs. Docker Desktop for Local Development”
Have you looked at k3s from rancher? Easy to bring up, very small footprint and pretty current with the latest k8s
Good stuff! Thorough and succinct, very useful!
I like to use:
$ eval $(minikube docker-env)
so I can build images and use them in my deployments to minikube without having to push to a real registry, as part of my development workflow. That way I never need a local Docker registry.
LikeLiked by 1 person
I was looking for something similar to help me understand the main differences. I created a Virtual Machine to install Ubuntu and then install microk8s to do some testing but all my projects are working on Windows and I needed to choose between minikube and any other solution. Due to this explanation, I think I’ve made my choice accurately.