local docker image on minikube

+3 votes
I want to use local docker images directly with minikube instaed of uploading and downloading them and then deploying them on minikube. How do i go about this?
Aug 29, 2018 in Kubernetes by lina
• 8,110 points
5,687 views

3 answers to this question.

–1 vote

Use the following steps:

  1. set the environment variables with eval $(minikube docker-env)
  2. build the image with the Docker daemon of Minukube (eg docker build -t my-image .)
  3. set the image in the pod spec like the build tag (eg my-image)
  4. set the imagePullPolicy to Never, otherwise Kubernetes will try to download the image.
answered Aug 29, 2018 by Kalgi
• 40,440 points
–1 vote

Use a local registry:

docker run -d -p 5000:5000 --restart=always --name registry registry:2

Now tag your image properly:

docker tag ubuntu localhost:5000/ubuntu

Note that localhost should be changed to dns name of the machine running registry container.

Now push your image to local registry:

docker push localhost:5000/ubuntu

You should be pull it back:

docker pull localhost:5000/ubuntu

Now change your yaml file to use local registry.

answered Aug 29, 2018 by Hannah
• 14,070 points
–1 vote

Try something like this:

# Start minikube
minikube start

# Set docker env
eval $(minikube docker-env)

# Build image
docker build -t foo:0.0.1 .

# Run in minikube
kubectl run hello-foo --image=foo:0.0.1 --image-pull-policy=Never

# Check that it's running
kubectl get pods
answered Aug 29, 2018 by Nilesh
• 6,880 points

Related Questions In Kubernetes

0 votes
1 answer

Running a custom docker image on GKE

You'll have tom push your image to ...READ MORE

answered Sep 18, 2018 in Kubernetes by ajs3033
• 7,280 points
135 views
0 votes
1 answer

Using local docker images with Minikube

You can reuse the Docker daemon from ...READ MORE

answered Jan 3 in Kubernetes by ajs3033
• 7,280 points
410 views
0 votes
2 answers
0 votes
1 answer

Accessing private Docker Hub repository from Kubernetes on Vagrant

In order to pull private dockerhub hosted ...READ MORE

answered Sep 18, 2018 in Kubernetes by DareDev
• 6,810 points
187 views
0 votes
1 answer
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
999 views
0 votes
2 answers

run private docker images on Google Container Engine

run docker login on minions before starting.  ...READ MORE

answered Aug 30, 2018 in Kubernetes by Nilesh
• 6,880 points
31 views
0 votes
1 answer

image can't be pulled error when I try to pull a docker image - kubernetes

I think the image is being pulled ...READ MORE

answered Sep 4, 2018 in Kubernetes by Kalgi
• 40,440 points
528 views