<p>I am very new to Kuberetes and I have done some work with docker previously. I am trying to accomplish following:</p>

<ol>
<li>Spin up Minikube</li>
<li>Use Kube-ctl to spin up a docker image from docker hub.</li>
</ol>

<p>I started minikube and things look like they are up and running. Then I pass following command</p>

<p>kubectl run nginx --image=nginx (Please note I do not have this image anywhere on my machine and I am expecting k8 to fetch it for me)</p>

<p>Now, when I do that, it spins up the pod but the status is <code>ImagePullBackOff</code>. So I ran <code>kubectl describe pod</code> command on it and the results look like following:</p>

<pre><code>Events:
  Type     Reason     Age              From               Message
  ----     ------     ----             ----               -------
  Normal   Scheduled  8m               default-scheduler  Successfully assigned default/ngix-67c6755c86-qm5mv to minikube
  Warning  Failed     8m               kubelet, minikube  Failed to pull image "nginx": rpc error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.64.1:53: read udp 192.168.64.2:52133-&gt;192.168.64.1:53: read: connection refused
  Normal   Pulling    8m (x2 over 8m)  kubelet, minikube  Pulling image "nginx"
  Warning  Failed     8m (x2 over 8m)  kubelet, minikube  Error: ErrImagePull
  Warning  Failed     8m               kubelet, minikube  Failed to pull image "nginx": rpc error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.64.1:53: read udp 192.168.64.2:40073-&gt;192.168.64.1:53: read: connection refused
  Normal   BackOff    8m (x3 over 8m)  kubelet, minikube  Back-off pulling image "nginx"
  Warning  Failed     8m (x3 over 8m)  kubelet, minikube  Error: ImagePullBackOff
</code></pre>

<p>Then I searched around to see if anyone has faced similar issues and it turned out that some people have and they did resolve it by restarting minikube using some more flags which look like below:</p>

<p><code>minikube start --vm-driver="xhyve" --insecure-registry="$REG_IP":80</code></p>

<p>when I do <code>nslookup</code> inside Minikube, it does resolve with following information:</p>

<pre><code>Server:         10.12.192.22
Address:        10.12.192.22#53

Non-authoritative answer:
hub.docker.com  canonical name = elb-default.us-east-1.aws.dckr.io.
elb-default.us-east-1.aws.dckr.io       canonical name = us-east-1-elbdefau-1nlhaqqbnj2z8-140214243.us-east-1.elb.amazonaws.com.
Name:   us-east-1-elbdefau-1nlhaqqbnj2z8-140214243.us-east-1.elb.amazonaws.com
Address: 52.205.36.130
Name:   us-east-1-elbdefau-1nlhaqqbnj2z8-140214243.us-east-1.elb.amazonaws.com
Address: 3.217.62.246
Name:   us-east-1-elbdefau-1nlhaqqbnj2z8-140214243.us-east-1.elb.amazonaws.com
Address: 35.169.212.184
</code></pre>

<p>still no luck. Is there anything that I am doing wrong here?</p>

<p>There error message suggests that the Docker daemon running in the minikube VM can't resolve the <code>registry-1.docker.io</code> hostname because the DNS nameserver it's configured to use for DNS resolution (<code>192.168.64.1:53</code>) is refusing connection. It's strange to me that the Docker deamon is trying to resolve <code>registry-1.docker.io</code> via a nameserver at <code>192.168.64.1</code> but when you <code>nslookup</code> on the VM it's using a nameserver at <code>10.12.192.22</code>. I did an Internet search for "minkube Get registry-1.docker.io/v2: dial tcp: lookup registry-1.docker.io on 192.168.64.1:53" and found an issue where someone made <a href="https://github.com/docker/for-mac/issues/1906#issuecomment-361833738" rel="noreferrer">this comment</a>, seems identical to your problem, and seems specific to <code>xhyve</code>.</p>

<p>In that comment the person says:</p>

<blockquote>
  <p>This issue does look like an xhyve issue not seen with virtualbox.</p>
</blockquote>

<p>and</p>

<blockquote>
  <p>Switching to <strong>virtualbox</strong> fixed this issue for me.</p>
  
  <p>I stopped minikube, deleted it, started it without <code>--vm-driver=xhyve</code> (minikube uses virtualbox driver by default), and then <code>docker build -t hello-node:v1 .</code> worked fine without errors</p>
</blockquote>
