How to use existing Docker image in Kubernetes?

10/11/2018

I'm a beginner in Docker and Kubernetes. I would like to know how I can create a Pod of Kubernetes with an already created image of Docker?

-- Shirley
docker
kubernetes

1 Answer

10/11/2018

Here are the steps

  1. Tag the Docker image.

  2. Push the image to registry (http://hub.docker.com/ or something else).

  3. Run the image in a pod using the below command.

kubectl run some-pod-name --image=image-name-in-registry --restart=Never

  1. Check if the Pod is running or not.

kubectl get pods

There are many other ways of creating a Pod, but this is the simplest way.

Also, there are the basics of K8S. Would recommend to go through the K8S documentation here and try different things.

If you don't have an access to K8S cluster, try the below. They can be done in the browser with zero-installation.

Katakoda Kubernetes

Play with Kubernetes

RedHat OpenShift

-- Praveen Sripati
Source: StackOverflow