title: How can I use a local docker image in Kubernetes?
body: <p>I have this basic Dockerfile:</p>
  
  <pre><code>FROM nginx
  RUN apt-get -y update &amp;&amp; apt install -y curl
  </code></pre>
  
  <p>In the master node of my Kubernetes cluster I build that image:</p>
  
  <pre><code>docker build -t cnginx:v1 . 
  </code></pre>
  
  <p><code>docker images</code> shows that the image has been correctly generated:</p>
  
  <pre><code>REPOSITORY                                 TAG                 IMAGE ID            CREATED             SIZE
  cgninx                                     v1                  d3b1b19d069e        39 minutes ago      141MB
  </code></pre>
  
  <p>I use this deployment referencing this custom image:</p>
  
  <pre><code>apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
  kind: Deployment
  metadata:
    name: nginx-deployment
  spec:
    selector:
      matchLabels:
        app: nginx
    replicas: 2 
    template: 
      metadata:
        labels:
          app: nginx
      spec:
        containers:
        - name: cnginx
          image: cnginx:v1
          imagePullPolicy: Never
          ports:
          - containerPort: 80
        nodeSelector:
          nodetype: webserver
  </code></pre>
  
  <p>However the image is not found: </p>
  
  <pre><code>NAME                                READY     STATUS              RESTARTS   AGE
  nginx-deployment-7dd98bd746-lw6tp   0/1       ErrImageNeverPull   0          4s
  nginx-deployment-7dd98bd746-szr9n   0/1       ErrImageNeverPull   0          4s
  </code></pre>
  
  <p>Describe pod info:</p>
  
  <pre><code>Events:
    Type     Reason                 Age              From                Message
    ----     ------                 ----             ----                -------
    Normal   Scheduled              1m               default-scheduler   Successfully assigned nginx-deployment-7dd98bd746-szr9n to kubenode2
    Normal   SuccessfulMountVolume  1m               kubelet, kubenode2  MountVolume.SetUp succeeded for volume "default-token-bpbpl"
    Warning  ErrImageNeverPull      9s (x9 over 1m)  kubelet, kubenode2  Container image "cnginx:v1" is not present with pull policy of Never
    Warning  Failed                 9s (x9 over 1m)  kubelet, kubenode2  Error: ErrImageNeverPull
  </code></pre>
  
  <p>I have also tried using the default imagePullPolicy, and some other things such as tagging the image with latest...</p>
  
  <p>So, how can I make Kubernetes use a locally generated docker image?</p>