<p>I'm trying to use minikube and kitematic for testing kubernetes on my local machine. However, kubernetes fail to pull image in my local repository (<code>ImagePullBackOff</code>).</p>

<p>I tried to solve it with this : <a href="https://stackoverflow.com/questions/38748717/can-not-pull-docker-image-from-private-repo-when-using-minikube">Can not pull docker image from private repo when using Minikube</a></p>

<p>But I have no <code>/etc/init.d/docker</code>, I think it's because of kinematic ? (I am on OS X)</p>

<p><strong>EDIT :</strong></p>

<p>I installed <a href="https://github.com/docker/docker-registry" rel="noreferrer">https://github.com/docker/docker-registry</a>, and</p>

<pre><code>docker tag local-image-build localhost:5000/local-image-build

docker push localhost:5000/local-image-build
</code></pre>

<p>My kubernetes yaml contains :</p>

<pre><code>spec:
  containers:
  - name: backend-nginx
    image: localhost:5000/local-image-build:latest
    imagePullPolicy: Always
</code></pre>

<p>But it's still not working...
Logs :</p>

<pre><code>Error syncing pod, skipping: failed to "StartContainer" 
for "backend-nginx" with ErrImagePull: "Error while pulling image: 
Get http://127.0.0.1:5000/v1/repositories/local-image-build/images: 
dial tcp 127.0.0.1:5000: getsockopt: connection refused
</code></pre>

<p><strong>EDIT 2 :</strong></p>

<p>I don't know if I'm on the good path, but I find this :</p>

<p><a href="http://kubernetes.io/docs/user-guide/images/" rel="noreferrer">http://kubernetes.io/docs/user-guide/images/</a></p>

<p>But I don't know what is my DOCKER_USER...</p>

<pre><code>kubectl create secret docker-registry myregistrykey --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL
</code></pre>

<p><strong>EDIT 3</strong></p>

<p>now I got on my pod :</p>

<pre><code>Failed to pull image "local-image-build:latest": Error: image library/local-image-build not found
Error syncing pod, skipping: failed to "StartContainer" for "backend-nginx" with ErrImagePull: "Error: image library/local-image-build not found"
</code></pre>

<p>Help me I'm going crazy.</p>

<p><strong>EDIT 4</strong></p>

<pre><code>Error syncing pod, skipping: failed to "StartContainer" for "backend-nginx" with ErrImagePull: "Error response from daemon: Get https://192.168.99.101:5000/v1/_ping: tls: oversized record received with length 20527"
</code></pre>

<p>I added :</p>

<pre><code>EXTRA_ARGS='
    --label provider=virtualbox
    --insecure-registry=192.168.99.101:5000
</code></pre>

<p>to my docker config, but it's still don't work, the same message....</p>

<p>By the way, I changed my yaml :</p>

<pre><code> spec:
      containers:
      - name: backend-nginx
        image: 192.168.99.101:5000/local-image-build:latest
        imagePullPolicy: Always
</code></pre>

<p>And I run my registry like that :</p>

<pre><code>docker run -d -p 5000:5000 --restart=always --name myregistry registry:2
</code></pre>

Xero
<p>Use the minikube docker registry instead of your local docker</p>

<p><a href="https://kubernetes.io/docs/tutorials/stateless-application/hello-minikube/#create-a-docker-container-image" rel="noreferrer">https://kubernetes.io/docs/tutorials/stateless-application/hello-minikube/#create-a-docker-container-image</a></p>

<h2>Set docker to point to minikube</h2>

<p><code>eval $(minikube docker-env)</code></p>

<h2>Push to minikube docker</h2>

<p><code>docker build -t hello-node:v1 .</code></p>

<h2>Set your deployment to not pull IfNotPresent</h2>

<p>K8S default is set to "Always"
Change to "IfNotPresent"</p>

<p><code>imagePullPolicy: IfNotPresent</code></p>

<p><a href="https://stackoverflow.com/questions/40144138/pull-a-local-image-to-run-a-pod-in-kubernetes">Related Issue</a></p>
