How to load a local Docker image in Minikube running on CRI-O?

1.9k Views Asked by At

To build and run a Docker image in Minikube running on the Docker container runtime, all I have to do is this:

eval $(minikube docker-env)
docker build -t some/tag .

Minikube will find the image.

But if I run Minikube in cri-o mode, this doesn't work, as expected. Is there a way to load a local Docker image and use that? In theory, any OCI-compliant container image should work?

Also, I'm on macOS if that matters.

2

There are 2 best solutions below

0
On

Ok, so the official way for Minikube is apparently the registry addon: https://minikube.sigs.k8s.io/docs/tasks/registry/insecure/

Sounds great, unfortunately K8S refused to pull images from localhost:5000, I had to use the registry-proxy-ip:80 prefix in the image spec to convince it to pull. I filed an issue here: https://github.com/kubernetes/minikube/issues/6012

1
On

Would

podman build -t some/tag .

Work for you?

Not really sure of the environment. On the VM you can also do something like

podman pull docker-daemon:some/tag

which would populate the cri-o storage.

Skopeo has similar commands.