To set up a local Docker image registry for Minikube, you primarily need Docker installed on your host machine and the official registry:2 Docker image, or you can use Minikube's built-in registry addon. [1, 2, 3, 4]
Specific Software and Tools Needed
- Docker (or a compatible container runtime) on your host machine to run the registry container and build/push images. [2, 5]
- The
registry:2Docker image if you choose to run a standard local container registry (docker run -d -p 5000:5000 --restart=always --name registry registry:2). [2, 3, 4] - Minikube itself, along with optional built-in commands like
minikube addons enable registryif you prefer Minikube to host the registry cluster-side. [2]
Alternative Ways to Use Local Images Without a Registry
- Use Minikube’s Docker Daemon Directly: Point your shell to Minikube's internal Docker daemon using
eval $(minikube docker-env), then build your image (docker build) directly inside Minikube so Kubernetes can access it immediately. [6, 7, 8] - Load Images Directly: Build the image on your host and load it into Minikube using:
- Build Inside Minikube: Build an image straight from a Dockerfile inside the cluster:(Remember to set
imagePullPolicy: IfNotPresentorimagePullPolicy: Neverin your Kubernetes pod YAML so it doesn't try to pull from a remote repository). [6, 7]
minikube image load for a simpler workflow?