<p>I'm using minikube on macOS 10.12 and trying to use a private image hosted at docker hub. I know that minikube launches a VM that as far as I know will be the unique node of my local kubernetes cluster and that will host all my pods.</p>

<p>I read that I could use the VM's docker runtime by running <code>eval $(minikube docker-env)</code>. So I used those variables to change from my local docker runtime to the other. Running <code>docker images</code> I could see that the change was done effectively.</p>

<p>My next step was to log in at docker hub using <code>docker login</code> and then pulling my image manually, which ended without error. After that I thought that the image will by ready to by be used by any pod in the cluster but I'm always getting <code>ImagePullBackOff</code>. I also tried to ssh into the VM via <code>minikube ssh</code> and the result is the same, the image is there to be used but for some reason I don't know it's refusing to use it.</p>

<p>In case it helps, this is my deployment description file:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: web-deployment
spec:
  replicas: 1
template:
  metadata:
    labels:
      app: nginx
  spec:
    containers:
    - name: nginx
      image: godraude/nginx
      imagePullPolicy: Always
      ports:
      - containerPort: 80
      - containerPort: 443
</code></pre>

<p>And this is the output of <code>kubectl describe pod &lt;podname&gt;</code>:</p>

<pre><code>Events:
  FirstSeen LastSeen    Count   From            SubobjectPath       Type        Reason      Message
  --------- --------    -----   ----            -------------       --------    ------      -------
  1m        1m      1   {default-scheduler }                Normal      Scheduled   Successfully assigned web-deployment-2451628605-vtbl8 to minikube
  1m        23s     4   {kubelet minikube}  spec.containers{nginx}  Normal      Pulling     pulling image "godraude/nginx"
  1m        20s     4   {kubelet minikube}  spec.containers{nginx}  Warning     Failed      Failed to pull image "godraude/nginx": Error: image godraude/nginx not found
  1m        20s     4   {kubelet minikube}              Warning     FailedSync  Error syncing pod, skipping: failed to "StartContainer" for "nginx" with ErrImagePull: "Error: image godraude/nginx not found"

  1m    4s  5   {kubelet minikube}  spec.containers{nginx}  Normal  BackOff     Back-off pulling image "godraude/nginx"
  1m    4s  5   {kubelet minikube}              Warning FailedSync  Error syncing pod, skipping: failed to "StartContainer" for "nginx" with ImagePullBackOff: "Back-off pulling image \"godraude/nginx\""
</code></pre>

<p>i think what u need is to create a secrete which will tell kube from where it can pull your private image and its credentials</p>

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

<p>below command to list your secretes</p>

<pre><code>kubectl get secret
NAME            TYPE                      DATA      AGE
my-secret   kubernetes.io/dockercfg   1         100d
</code></pre>

<p>now in deployment defination u need to define whcih secret to use</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: web-deployment
spec:
  replicas: 1
template:
  metadata:
    labels:
      app: nginx
  spec:
    containers:
    - name: nginx
      image: godraude/nginx
      imagePullPolicy: Always
      ports:
      - containerPort: 80
      - containerPort: 443
    imagePullSecrets:
      - name: my-secret
</code></pre>
