title: How to pull a private container from AWS ECR to a local cluster
body: <p>I am currently having trouble trying to pull my remote docker image hosted via AWS ECR. I am getting this error when running a deployment </p>
  
  <p>Step 1)</p>
  
  <p>run </p>
  
  <pre><code>aws ecr get-login-password --region cn-north-1 | docker login --username AWS --password-stdin xxxxxxxxxx.dkr.ecr.cn-north-1.amazonaws.com.cn
  </code></pre>
  
  <p>Step 2)</p>
  
  <p>run <code>kubectl create -f backend.yaml</code></p>
  
  <p>from here the following happens:</p>
  
  <pre><code>➜  backend git:(kubernetes-fresh) ✗ kubectl get pods
  NAME                      READY   STATUS             RESTARTS   AGE
  backend-89d75f7df-qwqdq   0/1     Pending            0          2s
  
  ➜  backend git:(kubernetes-fresh) ✗ kubectl get pods
  NAME                      READY   STATUS              RESTARTS   AGE
  backend-89d75f7df-qwqdq   0/1     ContainerCreating   0          4s
  
  ➜  backend git:(kubernetes-fresh) ✗ kubectl get pods
  NAME                      READY   STATUS             RESTARTS   AGE
  backend-89d75f7df-qwqdq   0/1     ErrImagePull       0          6s
  
  ➜  backend git:(kubernetes-fresh) ✗ kubectl get pods
  NAME                      READY   STATUS             RESTARTS   AGE
  backend-89d75f7df-qwqdq   0/1     ImagePullBackOff   0          7s
  </code></pre>
  
  <p>So then I run <code>kubectl describe pod backend</code> and it will output:</p>
  
  <pre><code>Events:
    Type     Reason     Age                 From               Message
    ----     ------     ----                ----               -------
    Normal   Scheduled  117s                default-scheduler  Successfully assigned default/backend-89d75f7df-qwqdq to minikube
    Normal   Pulling    32s (x4 over 114s)  kubelet, minikube  Pulling image "xxxxxxxxx.dkr.ecr.cn-north-1.amazonaws.com.cn/baopals:latest"
    Warning  Failed     31s (x4 over 114s)  kubelet, minikube  Failed to pull image "xxxxxxxxx.dkr.ecr.cn-north-1.amazonaws.com.cn/baopals:latest": rpc error: code = Unknown desc = Error response from daemon: Get https://xxxxxxxxx.dkr.ecr.cn-north-1.amazonaws.com.cn/v2/baopals/manifests/latest: no basic auth credentials
    Warning  Failed     31s (x4 over 114s)  kubelet, minikube  Error: ErrImagePull
    Warning  Failed     19s (x6 over 113s)  kubelet, minikube  Error: ImagePullBackOff
    Normal   BackOff    4s (x7 over 113s)   kubelet, minikube  Back-off pulling image "xxxxxxxxx.dkr.ecr.cn-north-1.amazonaws.com.cn/baopals:latest"
  
  </code></pre>
  
  <p>the main error being <code>no basic auth credentials</code></p>
  
  <p>Now what I am confused about is that I can push images to my ECR fine and I can also push to my remote EKS cluster I feel like essentially the only thing I cant do right now is pull from my private repository that is hosted on ECR.</p>
  
  <p>Is there something obvious that I'm missing here that is preventing me from pulling from private repos so i can use them on my local machine?</p>