1

I was trying to deploy my local docker image on kubernetes, but doesn't work for me. I loaded image into docker and tagged it as app:v1, then I ran image by use kubectl this way kubectl run app --image=app:v1 --port=8080.

If I want to lookup my pods I see error "Failed to pull image "app:v1": rpc error: code = 2 desc = Error: image library/app not found".

What am I doing wrong?

siwymilek
  • 815
  • 1
  • 6
  • 24
  • Can you try adding '--image-pull-policy=IfNotPresent' to kubectl run ? – Sri Apr 11 '17 at 13:31
  • Yes. You can follow this link, https://stackoverflow.com/questions/68072772/how-to-refer-local-docker-images-loaded-from-tar-file-in-kubernetes-deployment/72362073#72362073 – Soumya May 24 '22 at 11:30
  • @Soumya been waiting for 5 years to solve my problem :) thanks bro – siwymilek May 25 '22 at 12:16

1 Answers1

1

In normal case your Kubernetes cluster runs on a different machine than your docker build was run on, hence it has no access to your local image (unless you are using minikube and you eval minikubes environment to actually run your docker commands against docker daemon powering the minikube install).

To get it working you need to push the image to a registry available to kubernetes cluster.

By running your command you actually tell kubernetes to pull app:v1 from official docherhub hosted images.

mowzy
  • 105
  • 1
  • 8
Radek 'Goblin' Pieczonka
  • 21,554
  • 7
  • 52
  • 48