Unable to pull images from insecure registry through minikube

7/14/2020

I have a local insecure docker registry which I created using the command:

docker run -d -p 5000:5000 --restart=always --name registry registry:2` 

I have added this to the /etc/docker/daemon.json as well. I tagged several images in the format localhost:5000/<orgname>/<imagename>:<tag> and pushed them to the insecure registry.

When I run curl -X GET localhost:5000/v2/_catalog I can see that they are available inside the local registry.

I started minikube with the command minikube start --insecure-registry="localhost:5000". Here, my default driver is docker (I also tried with kvm2). I enabled the registry addon as well using the command minikube addons enable registry

I have a configmap which states the image in the format I mentioned earlier. When I apply this using kubectl, I get an ImagePullBackoff error with the error message

Failed to pull image "localhost:5000/org/product:tag": rpc error: code = Unknown desc = Error response from daemon: manifest for localhost:5000/org/product:tag not found: manifest unknown: manifest unknown

Any ideas as to why this is happening?

Docker version: 19.03.8, build afacb8b7f0

Minikube version: 1.9.2

Ubuntu 20.04 LTS

-- RrR-
docker
docker-registry
kubectl
kubernetes
minikube

3 Answers

7/31/2020

I was able to solve this issue by replacing localhost with my IP.

minikube start --insecure-registry="<IP-of-your-computer>:5000"

Have to use the IP instead of localhost when tagging and pushing images to te local registry as well.

-- RrR-
Source: StackOverflow

10/19/2021

I used following on Ubuntu 20.04 1. Start the minikube with insecure-registry as your computer's ip:
minikube start --insecure-registry="<your-computer-ip>:5000" 2. Enable the registry:
minikube addons enable registry 3. make sure registry is up and running:
kubectl get service --namespace kube-system

<pre> > NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE > kube-dns ClusterIP 10.96.0.10 none 53/UDP,53/TCP,9153/TCP 54m > registry ClusterIP 10.98.34.133 none 80/TCP,443/TCP 37m </pre>
  1. Portforward to localhost:
    kubectl port-forward --namespace kube-system service/registry 5000:80
  2. Build and push your images to localhost
    docker tag my/image localhost:5000/myimage
    docker push localhost:5000/myimage
  3. Use the image in deployment yaml and apply using kubectl in yaml file:<pre>containers: - name: app-name image: <bold>localhost:5000/image-name:latest</pre>
-- Neeraj Gulia
Source: StackOverflow

7/14/2020

Well, the minikube K8s subnet is different from the one that your registry is running so localhost is not going to work without some tweaks. I recommend following the minikube official guide and not run:

docker run -d -p 5000:5000 --restart=always --name registry registry:2` 

In essence, it says that after running:

minikube addons enable registry

Then when you create your minikube instance

minikube start --drive=docker --insecure-registry "10.0.0.0/24"
-- Rico
Source: StackOverflow