<p>I have installed docker-registry on Kubernetes via helm.</p>

<p>I am able to docker push to <code>docker push 0.0.0.0:5000/&lt;my-container&gt;:v1</code> using port-forward.</p>

<p>Now how do I reference the images in the registry from a deployment.yaml?</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: &lt;my-container&gt;-deployment-v1
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: &lt;my-container&gt;-deployment
        version: v1
    spec:
      containers:
      - name: &lt;my-container&gt;
        image: 0.0.0.0:5000/&lt;my-container&gt;:v1 # &lt;&lt;&lt; ????
        imagePullPolicy: Always
        ports:
        - containerPort: 80
      imagePullSecrets:
        - name: private-docker-registry-secret
</code></pre>

<p>This do list my containers:</p>

<pre><code>curl -X GET http://0.0.0.0:5000/v2/_catalog
</code></pre>

<p>I keep getting <strong><em>ImagePullBackOff</em></strong> when deploying.</p>

<p>I tyied using internal service name and cluster ip address, still not working.</p>

<p>Then tried using secrets:</p>

<pre><code>{
  "kind": "Secret",
  "apiVersion": "v1",
  "metadata": {
    "name": "running-buffoon-docker-registry-secret",
    "namespace": "default",
    "selfLink": "/api/v1/namespaces/default/secrets/running-buffoon-docker-registry-secret",
    "uid": "127c93c1-53df-11e9-8ede-a63ad724d5b9",
    "resourceVersion": "216488",
    "creationTimestamp": "2019-03-31T18:01:56Z",
    "labels": {
      "app": "docker-registry",
      "chart": "docker-registry-1.7.0",
      "heritage": "Tiller",
      "release": "running-buffoon"
    }
  },
  "data": {
    "haSharedSecret": "xxx"
  },
  "type": "Opaque"
}
</code></pre>

<p>And added the secret to to deployment.yaml:</p>

<pre><code>  imagePullSecrets:
    - name: running-buffoon-docker-registry-secret
</code></pre>

<p>Then I get:<br></p>

<pre><code>image "x.x.x.x/:&lt;my-container&gt;v1": rpc error: code = Unknown desc = Error response from daemon: Get https://x.x.x.x/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
</code></pre>

Chris G.
<p>You need to get the <strong>cluster-ip</strong> of your local docker registry. </p>

<p>You will find this in the dashboard - just visit the registry pod page and then to the associated <code>service</code>. Replace your image spec's <code>0.0.0.0</code> with the cluster ip. Also make sure the <code>port</code> matches - generally the port exposed by registry service is different from the actual port exposed inside the cluster. If you have authentication set up in your registry, you will need <code>imagepullsecret</code> as well.</p>

<p>I have blogged about minikube setup with a local registry - might be helpful. <a href="https://amritbera.com/journal/minikube-insecure-registry.html" rel="nofollow noreferrer">https://amritbera.com/journal/minikube-insecure-registry.html</a></p>
