4
$ minikube image ls
...
docker.io/library/crasher:latest
...

$ minikube image rm crasher crasher:latest docker.io/library/crasher:latest

$ minikube image ls
...
docker.io/library/crasher:latest
...

It looks like minikube rm doesn't remove the image from minikubes internal cache. I would like to be able to remove one of these images so that I can be sure I when I minikube image load that it picks up the new image.

Forrest Keppler
  • 577
  • 3
  • 7
  • 20
  • whats the o/p of `ls ~/.minikube/cache/images/` – P.... Aug 20 '21 at 01:09
  • @P.... `crasher_latest counter.078460605.tmp counter.416244599.tmp` Which is surprising because `minikube cache list` doesnt return anything. – Forrest Keppler Aug 20 '21 at 02:35
  • 1
    try `minikube cache delete` then `rm` – P.... Aug 20 '21 at 02:42
  • You can refer the link [remove docker images from minikube](https://stackoverflow.com/questions/68721928/how-to-remove-existing-downloaded-docker-images-from-minikube/68722074) – Chandra Sekar Aug 20 '21 at 03:40
  • @ChandraSekar The accepted answer is specific to forcing minikube to pull a new remote image, rather then using a new local one. The other answers didnt work for one reason or another. – Forrest Keppler Aug 20 '21 at 04:03

2 Answers2

9

I figured it out, the problem was that I still had services running that were using the image.

You either can't delete an image in use, or minikube is adding the in use image back into the list faster than I can run commands.

So if you want to do a local hotswap of your image on minikube, you need to:

1. kubectl delete
2. minikube image rm
3. minikube image load
4. kubectl apply
vitaliis
  • 4,082
  • 5
  • 18
  • 40
Forrest Keppler
  • 577
  • 3
  • 7
  • 20
5

To delete image from Kubernetes :

 minikube image rm  your-image-name

To load local image to Kubernetes :

minikube image load your-image-name
Abd Abughazaleh
  • 4,615
  • 3
  • 44
  • 53