Minikube can run your local Docker images directly within the cluster, saving you the hassle of pushing them to a remote registry.

Here’s a simple example of how to load a local Docker image into Minikube:

First, build your Docker image locally. Let’s say you have a Dockerfile in your current directory:

FROM alpine:latest
CMD ["echo", "Hello from my custom image!"]

Build this image and tag it with a name that Minikube can easily recognize, for instance, my-custom-app:v1:

docker build -t my-custom-app:v1 .

Now, load this image into your Minikube cluster:

minikube image load my-custom-app:v1

This command tells Minikube to take the my-custom-app:v1 image that exists in your local Docker daemon and make it available inside the Minikube VM.

You can then use this image in your Kubernetes deployments:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
      - name: my-app-container
        image: my-custom-app:v1 # Use the locally loaded image
        ports:
        - containerPort: 80

Apply this deployment:

kubectl apply -f deployment.yaml

And verify that your pod is running using the local image:

kubectl get pods

You should see your my-app-deployment pod in a Running state. You can then check its logs to confirm it’s using your custom image:

kubectl logs <your-pod-name>

The primary problem this solves is avoiding the need for a remote container registry (like Docker Hub, Google Container Registry, or AWS Elastic Container Registry) when developing and testing applications locally with Kubernetes. Pushing and pulling images to and from registries can add significant overhead to your development workflow, especially if you’re iterating quickly. By loading images directly into Minikube, you eliminate this step, making the build-test-deploy cycle much faster.

Minikube achieves this by leveraging its internal Docker daemon or by interacting with your host’s Docker daemon (depending on your Minikube driver configuration). When you run minikube image load <image-name>, Minikube essentially serializes the image layers from your local Docker environment and transfers them to the Docker daemon running within the Minikube VM. Once transferred, the image is available for Kubernetes to pull and use for creating pods. This means that even though your kubectl commands are creating Kubernetes objects that reference my-custom-app:v1, Kubernetes doesn’t need to reach out to an external registry because the image is already present locally within the Minikube environment.

The minikube image load command is a convenience wrapper. Under the hood, it might be executing commands like docker save and docker load or similar operations that transfer image data. For example, if Minikube is configured to use your host’s Docker daemon (e.g., via the docker driver), it might directly access the image data. If it’s using its own internal Docker daemon (e.g., with the virtualbox or vmwarefusion drivers), it orchestrates the transfer of image data into that internal daemon. The key is that the image becomes locally available to the Minikube cluster’s container runtime.

Consider a scenario where you’re developing a microservice and want to test it in an isolated Kubernetes environment without exposing it to the internet or setting up a private registry. You build your service’s Docker image, tag it, and then minikube image load it. Your Kubernetes deployment YAML then points to this image. When you kubectl apply, the Kubernetes scheduler assigns your pod to a node (in this case, the single node in Minikube), and the Kubelet on that node asks the container runtime (Docker or containerd) to pull the image. Since the image is already loaded into Minikube’s runtime, it’s immediately available, and the pod starts quickly.

It’s important to note that minikube image load is distinct from minikube start --driver=docker. While the latter configures Minikube to use your host’s Docker daemon, minikube image load specifically transfers an existing image from your host’s Docker daemon into the Minikube environment’s image store. Even if Minikube is using its own internal Docker daemon, minikube image load still pulls the image data from your host.

A common pitfall is forgetting to tag your image with a specific version (e.g., my-custom-app:v1). If you only use a generic tag like my-custom-app and then build a new version, minikube image load might load the older version if it’s the one currently tagged as latest or the one it finds first. Always use explicit version tags for clarity and reproducibility.

The next step in managing local images with Minikube involves exploring how to automatically load images when Minikube starts, which can be configured using the kubeconfig or by specifying image loading directly in the minikube start command with --extra-data.

Want structured learning?

Take the full Minikube course →