HudsonHornet
HudsonHornet

Reputation: 89

How to push and deploy local image to kubernetes

I have started to learn kubernetes. So, I have installed minikube, and I don't know how to push my local builded image to kubernetes. I'm doing next:

minikube start 
eval $(minikube docker-env) 
docker build -t some_image  

But when I run docker images, there isn't my image. So can you help me, how to push and deploy my local docker image?

Upvotes: 4

Views: 4780

Answers (2)

Sumit Murari
Sumit Murari

Reputation: 1699

Answer shared by @fatcook is good reference point, a simpler solution would be.

Before building the docker image just execute : eval $(minikube docker-env).

It will export following variables.

export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/Users/username/.minikube/certs"
export DOCKER_API_VERSION="x.yy"
# Run this command to configure your shell:
# eval $(minikube docker-env)

Now you can build images docker build and it will be available on minikube instance.

It's a simple dirty way to go.

Upvotes: 2

fatcook
fatcook

Reputation: 1026

You need to set a local docker registry which minikube can use to pull images from. Check this link https://blog.hasura.io/sharing-a-local-registry-for-minikube-37c7240d0615 which provides detailed explanation of how this can be achieved.

You can also set your own registry and use it in your yamls to pull images. Just tag your images with something like localhost:5000/your-image-name and push them before running your pod on minikube

Upvotes: 1

Related Questions