Kubernetes: Specify a tarball docker image to run pod

3/27/2018

I have saved a docker image as a tar file locally using the command,

docker save -o ./dockerImage:version.tar docker.io/image:latest-1.0

How to specify this file in my pod.yaml to use this tarball and start the pod instead of pulling / already pulled image to launch the container.

Current pod.yaml file:

 apiVersion: myApp/v1
 kind: myKind
 metadata:
   name: myPod2
 spec:
   baseImage: docker.io/image
   version: latest-1.0

I want similar to this

 apiVersion: myApp/v1
 kind: myKind
 metadata:
   name: myPod2
 spec:
   baseImage: localDockerImage.tar:latest-1.0
   version: latest-1.0
-- Ashwin
docker
kubernetes
minikube

1 Answer

3/28/2018

There's no direct way to achieve that in Kubernetes.

See the discussions here: https://github.com/kubernetes/kubernetes/issues/1668

They have finally closed that issue because of the following reasons:

Given that there are a number of ways to do this (your own cluster startup scripts, run a daemonset to side load your custom images, create VM images with images pre-loaded, run a cluster-local docker registry), and the fact that there have been no substantial updates in over two years, I'm going to close this as obsolete.

-- Yuankun
Source: StackOverflow