<p>I have setup docker on my machine and also minikube which have docker inside it, so probably i have two docker instances running on different VM</p>

<p>I build an image and tag it then push it to local registry and it pushed successfully and i can pull it from registry too and also when i run curl to get tags list i got result, and here are what i did</p>

<pre><code>1- docker build -t 127.0.0.1:5000/eliza/console:0.0.1 .
2- docker run -d -p 5000:5000 --name registry registry:2
3- docker tag a3703d02a199 127.0.0.1:5000/eliza/console:0.0.1
4- docker push 127.0.0.1:5000/eliza/console:0.0.1
5- curl -X GET http://127.0.0.1:5000/v2/eliza/console/tags/list
</code></pre>

<p>all above steps are working fine with no problems at all.</p>

<p>My problem is when i run minikube and try to access this image in local registry inside it</p>

<p>So when i run next commands</p>

<pre><code>1- sudo minikube start --insecure-registry 127.0.0.1:5000
2- eval $(minikube docker-env)
3- minikube ssh
4- curl -X GET http://127.0.0.1:5000/v2/eliza/console/tags/list
</code></pre>

<p>in last step (point 4) it gave me next message</p>

<blockquote>
  <p>curl: (7) Failed to connect to 127.0.0.1 port 5000: Connection refused</p>
</blockquote>

<p>So i can access image registry from my machine but not from minikube which make a problems of course with me when i deploy this image using Kubernetes on minikube and make deploy failed due to can't connect to <a href="http://127.0.0.1:5000" rel="noreferrer">http://127.0.0.1:5000</a></p>

<p>Can you help me configuring minikube to see my local registry so my problem will be solved then i can deploy image to minikube using kubernetes successfully?</p>

<p><strong>UPDATE</strong></p>

<p>I am using this yaml file (i named it <em>ConsolePre.yaml</em>) to deploy my image using kubernetes</p>

<pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: tripbru-console
    labels:
      app: tripbru-console
  spec:
    ports:
      - port: 9080
        targetPort: 9080
        nodePort: 30181
    selector:
      app: tripbru-console
      tier: frontend
    type: NodePort
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: tripbru-console
  labels:
    app: tripbru-console
spec:
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: tripbru-console
        tier: frontend
    spec:
      containers:
      - image: docker.local:5000/eliza/console:0.0.1
        name: tripbru-console
        ports:
        - containerPort: 9080
          name: tripbru-console
</code></pre>

<p>and when i run next command to apply changes</p>

<blockquote>
  <p>sudo kubectl apply -f /PATH_TO_YAML_FILE/ConsolePre.yaml</p>
</blockquote>

<p>the result is </p>

<pre><code>NAME                                      READY     STATUS         RESTARTS   AGE
po/tripbru-console-1655054400-x3g87       0/1       ErrImagePull   0          1m
</code></pre>

<p>and when i run describe command</p>

<blockquote>
  <p>sudo kubectl describe pod tripbru-console-1655054400-x3g87</p>
</blockquote>

<p>i found next message in description result</p>

<blockquote>
  <p>Error response from daemon: {"message":"Get
  <a href="https://docker.local:5000/v1/_ping" rel="noreferrer">https://docker.local:5000/v1/_ping</a>: dial tcp: lookup docker.local on
  10.0.2.3:53: read udp 10.0.2.15:57792-\u003e10.0.2.3:53: i/o timeout"}</p>
</blockquote>

<p>and i configured <strong>docker.local xxx.xxx.xx.4</strong> in minikube /etc/hosts so i don't know from where 10.0.2.3:53 and 10.0.2.15:57792 come from.</p>

<p>So how can i solve this issue too.    </p>

<p>Thanks :)</p>

<p>The issue is your notion using <code>127.0.0.1</code> anywhere you want. This is wrong.</p>
<p>So if your machine IP is 192.168.0.101. Then below works</p>
<pre><code>1- docker build -t 127.0.0.1:5000/eliza/console:0.0.1 .
2- docker run -d -p 5000:5000 --name registry registry:2
3- docker tag a3703d02a199 127.0.0.1:5000/eliza/console:0.0.1
4- docker push 127.0.0.1:5000/eliza/console:0.0.1
5- curl -X GET http://127.0.0.1:5000/v2/eliza/console/tags/list
</code></pre>
<p>Because docker run maps the registry to 127.0.0.1:5000 and 192.168.0.101:5000. Now on your machine only this <code>127.0.0.1</code> will work. Now when you use</p>
<pre><code>3- minikube ssh
</code></pre>
<p>You get inside the minikube machine and that doesn't have a registry running on 127.0.0.1:5000. So the error. The registry is no reachable inside this machine using the machine IP.</p>
<p>The way I usually solve this is issue is by using host name both locally and inside the other VMs.</p>
<p>So on your machine create a entry in <code>/etc/hosts</code></p>
<pre><code>docker.local 127.0.0.1
</code></pre>
<p>And change your commands to</p>
<pre><code>1- docker build -t docker.local:5000/eliza/console:0.0.1 .
2- docker run -d -p 5000:5000 --name registry registry:2
3- docker tag a3703d02a199 docker.local:5000/eliza/console:0.0.1
4- docker push docker.local:5000/eliza/console:0.0.1
5- curl -X GET http://docker.local:5000/v2/eliza/console/tags/list
</code></pre>
<p>And then when you use <code>minikube ssh</code>, make a entry for <code>docker.local</code> in <code>/etc/hosts</code></p>
<pre><code>docker.local 192.168.0.101
</code></pre>
<p>Then <code>curl -X GET http://docker.local:5000/v2/eliza/console/tags/list</code></p>
<p><strong>Edit-1</strong></p>
<p>For the TLS issue you need to Stop the docker service inside minikube</p>
<pre><code>systemctl stop docker
</code></pre>
<p>Then edit <code>/etc/systemd/system/docker.service.d/10-machine.conf</code> and change</p>
<blockquote>
<p>ExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=virtualbox --insecure-registry 10.0.0.0/24</p>
</blockquote>
<p>to</p>
<blockquote>
<p>ExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=virtualbox --insecure-registry 10.0.0.0/24 --insecure-registry docker.local:5000 --insecure-registry 192.168.1.4:5000</p>
</blockquote>
<p>Then reload daemon and start the docker service</p>
<pre><code>systemctl daemon-reload
systemctl start docker
</code></pre>
<p>After that try to pull</p>
<pre><code>docker pull docker.local:5000/eliza/console:0.0.1
</code></pre>
<p>And the command should work</p>
