laxman
laxman

Reputation: 2100

how to use local images in kubernetes using minikube

I have just started working on k8s and I am doing some stuff locally,

I have a image created using docker desktop. Now, I want this image to be used within my minikube's VM environment. I want to create a deployment using kubectl create deployment hello-minikube --image=my_local_image_name. Going through docs, and as per my understanding, it tells us how docker desktop can be used to interact with the minikube's in-built docker demon. Following the instructions,

Running docker images gives me images within minikube's docker.

But, in my case I want the other way around. How can I do that ?

Secondly, as a add-on how can I store images within minikube's VM's docker ?

Upvotes: 0

Views: 1576

Answers (2)

Thomas Deville-Duc
Thomas Deville-Duc

Reputation: 21

Running docker images gives me images within minikube's docker.

When you have this behaviour in your shell, rebuild your docker image.

It will use Docker from Minikube and store your image into Minikube's Docker registry

Upvotes: 1

Rafał Leszko
Rafał Leszko

Reputation: 5521

Docker Desktop and Docker from Minikube are two separate Docker Engines. That is why they don't share the Docker image registry.

So you have the following options:

  1. Use Kubernetes from Docker Desktop instead of Minikube (Docker Desktop comes with Kubernetes cluster built-in).

  2. Build your Docker image with Docker Engine from Minikube (instead of Docker Desktop).

  3. Use external Docker registry (you can use Docker Hub or set up your own registry)

Upvotes: 3

Related Questions