How to let cron job pull the docker image once after deploying?

5/20/2019

I have a dozen of cron jobs on GKE. My docker registry is down. The status of these cron jobs becomes: ImagePullBackOff

My thinking is, the cron jobs should pull the docker image once after deploying and use the cached/local docker image.

Shouldn't pull the docker image every time from remote docker registry when the cron job creates a new pod. It's a waste, because the docker image doesn't change (I mean the application code of cron job).

So, is there a way to do this?

Purpose: if can do this, my cron jobs will always running using local docker image before next deploying, even if docker registry is down.

-- slideshowp2
cron
docker
google-cloud-platform
google-kubernetes-engine
kubernetes

1 Answer

5/20/2019

you can use one of the "Container Images" properties mentioned here.

Please setup in your deployment: imagePullPolicy: IfNotPresent.

Note:

if imagePullPolicy is omitted and either the image tag is :latest or it is omitted: Always is applied.

Please verify your deployment settings and verify also if docker images are present on the machine.

-- Hanx
Source: StackOverflow