How to deploy local docker registry with minikube?

11/1/2017

Using minikube and docker registry local. Created and pushed local images to docker registry:

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

Kubernetes config file:

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

But from kubernetes dashboard, the Pods area got error:

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

So how to use local docker images in registry correctly?

-- online
docker
docker-registry
kubernetes

1 Answer

11/1/2017

This is a solution:

https://blog.hasura.io/sharing-a-local-registry-for-minikube-37c7240d0615

I followed it did:

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

Then it pending:

Forwarding from 127.0.0.1:5000 -> 5000

I don't know the reason.

-- online
Source: StackOverflow