Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use local docker containers with Kubernetes

I have been trying Kubernetes, I have setup a master and minions in AWS. The documentation on docker + Kubernetes seems to be lacking, or maybe I was looking for it in the wrong place.

Lets say I build my docker containers on a local box (not in AWS). I donot have a docker registry.

Is it possible for me to tell Kubernetes to use my local containers when spinning up pods? Or do my containers need to be put in a docker registry?

like image 765
sam Avatar asked Feb 15 '16 15:02

sam


People also ask

Can Kubernetes use a local Docker image?

Kubernetes use local docker image is nothing but create Kubernetes image locally and deploy the same on Kubernetes cluster locally; the first step is to deploy our application on Kubernetes to build the docker image. Next, we need to use minikube to run the Kubernetes in our local environment.

Can you use Docker containers with Kubernetes?

Kubernetes can run Docker containers and 'docker build' images, but it is important to note that Kubernetes has depreciated support for Docker as a container runtime.


1 Answers

If the image was built on a host where Kubernetes is running, then yes, Kubernetes may use it on some conditions:

  • your pod is scheduled on a host where your image exists (pre-built / pre-pulled image scenario)
  • your pod pull policy is set to IfNotPresent (see Updating Images)

Using a private registry would make your life easier though, on top of that it's very easy to set up a local Docker registry with Kubernetes.

like image 185
Antoine Cotten Avatar answered Sep 22 '22 01:09

Antoine Cotten