Question: I'm deploying several services to my local cluster (`minikube`) using [DevSpace tool](https://devspace.sh/). Once someone makes changes to one of the services and pushes the image to our private repo, I need these changes to be available on my local then. What I do now is I completely delete `minikube` cluster and start a new one. In this case all images with same tags are just updated with the latest version, not a cached one.

But I believe there is some more elegant way to overcome this. So, I need to cleanup/remove/delete outdated images from my local cluster somehow before re-deploying services there.

Can someone point where they are stored, how I can review and remove them? Thanks.

Answer: 
You can try below commands

**Removing untagged images**:

```text
docker image rm $(docker images | grep "^<none>" | awk "{print $3}")

```

**Remove all stopped containers** :

```text
docker container rm $(docker ps -a -q)

```

(OR)

You need to stop and disable localkube service:

```text
systemctl disable localkube.service
systemctl stop localkube.service

```

After that you're able to stop and remove containers.

```text
docker system prune -a

```

which removes all the images
Instead of deleting all images, and recreating the cluster, you can perform a rolling update (this is assuming you are using deployments, as you should).

```text
kubectl set image deployments/<deployment-name>=<repository-name>/<image-name>:<image-tag>

```

This is also assuming, you are using proper versioning with tags.

Alternatively, if you are using images with the `latest` tag, you can change `ImagePullPolicy` to `Always`, then delete the neccessary pods with

```text
kubectl delete pod <pod-name> <pod2-name> ...

```

Newer image will be pulled as the new pods are created.

---

If you still want to delete unused docker images, you can do this with

```text
docker image prune -a

```

This will remove all images without at least one container associated to them.