siwymilek
siwymilek

Reputation: 815

Is possible to deploy local docker image on kubernetes?

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?

Upvotes: 1

Views: 1061

Answers (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.

Upvotes: 1

Related Questions