How to deploy a mirror image in the locally running Docker Registry with minikube in Mac?

  docker, question

Install minikube on the Mac, run the registry container and push the application.

$ curl http://localhost:5000/v2/_catalog
 {"repositories":["app1"]}

In kubernetes’ deployment configuration file:

...
 spec:
 replicas: 3
 template:
 metadata:
 labels:
 app: app1
 tier: backend
 spec:
 containers:
 - image: localhost:5000/app1
 name: app1
 ...

Error in dashboard’s Pods:

Failed to pull image "localhost:5000/app1": rpc error: code = 2 desc = Error while pulling image: Get http://localhost:5000/v1/repositories/app1/  images: dial tcp 127.0.0.1:5000: getsockopt: connection refused
 Error syncing pod

From this we can see the solution:

https://blog.hasura.io/sharin …

Docker-machine changed:

eval $(minikube docker-env)

In carrying out this step:

kubectl port-forward --namespace kube-system \
 $(kubectl get po -n kube-system | grep kube-registry-v0 | \
 awk '{print $1;  }') 5000:5000

Pending has not responded:

Forwarding from 127.0.0.1:5000 -> 5000

Why? How?

To do this:

Start minikube:

minikube start

Tag the local docker images and bring them to Kubernetes IP:

docker tag app1 192.168.99.100:5000/app1

At homeinsecure registriesAdd:192.168.99.100:5000

Pushed into Kubernets’ registry:

docker push 192.168.99.100:5000/app1

Check the registry for K8S:

curl http://192.168.99.100:5000/v2/_catalog
 {"repositories":["app1"]}

Switching docker machine to minikube:

eval $(minikube docker-env)

Perform deployment scheduling operations. Mirror access:192.168.99.100:5000/app1[:tag]


Useful resources

minikube start --insecure-registry "10.0.0.0/24"

https://github.com/kubernetes …