DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Smart Deployment Strategies for Modern Applications
  • How We Diagnosed a Hidden Scheduler Failure in a Docker Swarm Cluster Serving 2 Million Users
  • Java Backend Development in the Era of Kubernetes and Docker
  • Docker Hardened Images for Container Security

Trending

  • The Third Culture: Blending Teams With Different Management Models
  • LLM Integration in Enterprise Applications: A Practical Guide
  • No More Cheap Claude: 4 First Principles of Token Economics in 2026
  • 11 Agentic Testing Tools to Know in 2026
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Running Local Docker Images in Kubernetes

Running Local Docker Images in Kubernetes

This short tutorial gives you step-by-step instructions on how to run your local Docker images on Kubernetes using minikube.

By 
Milind Deobhankar user avatar
Milind Deobhankar
·
Updated Jun. 19, 19 · Tutorial
Likes (7)
Comment
Save
Tweet
Share
98.4K Views

Join the DZone community and get the full member experience.

Join For Free

Definitely one of the easiest deployment of Kubernetes in the local environment is using the minikube.

One should first understand that minikube is a virtual machine with the Docker engine installed. Docker engine running on your local machine has a different Docker daemon than the one installed in minikube.

You may also enjoy Linode's Beginner's Guide to Kubernetes.

Minikube's strategy is to pull the Docker images from the repository by default. There are predefined default repositories configured, but we will not go into those details. When you run the following command for creating the pod, it will fail with an error because it will not be able to pull the image from the repository.

kubectl run discovery –image=myproject/myimage –port=8761


This is because it is not able to find the repo. If you do ssh into minikube:

minikube ssh

>docker images


Then you will notice that there is no image for you to run.

There are lots of solution to this problem, like creating the repo and pushing the image to that, copying the image from local to minikube, etc. But the easiest solution is to build the image into minikube itself.

First, note that when you execute the command docker images  from your local prompt, it will display the images present in your local Docker environment.

Now we point local Docker environment to minikube using the following command:

eval $(minikube docker-env)


Now if you execute the following command from your terminal:

docker images


It will show the images in minikube and not from your local Docker environment.

Finally, build the image from your terminal:

docker build -t myproject/myimage .


The image will get build  into minikube and not into your local Docker environment. Verify this with the following command:

minikube ssh

>docker images


If you execute the following command now:

kubectl run discovery –image=myproject/myimage –port=8761


It will still fail with the same problem because Kubernetes, by default, works on the pull strategy and we need to disable it by executing the following command:

kubectl run discovery –image=myproject/myimage –image-pull-policy=Never –port=8761


Now if you inspect the pods:

kubectl get pods


It will show that it is successfully running.

Docker (software) Kubernetes

Opinions expressed by DZone contributors are their own.

Related

  • Smart Deployment Strategies for Modern Applications
  • How We Diagnosed a Hidden Scheduler Failure in a Docker Swarm Cluster Serving 2 Million Users
  • Java Backend Development in the Era of Kubernetes and Docker
  • Docker Hardened Images for Container Security

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook