The doc https://docs.openshift.com/container-platform/3.9/dev_guide/cron_jobs.html provides details of creating a cron job.
To start a scheduled task that executes a build every 10 mins I use the command:
oc run run-build 161/my-app --image=myimage --restart=OnFailure --schedule='*/10 * * * *'
Which returns:
cronjob.batch/run-build created
But the job fails to start:
The log of pod displays:
Error: unknown command "161/my-app" for "openshift-deploy"
Run 'openshift-deploy --help' for usage.
Have I configured the command ( oc run run-build 161/my-app --image=myimage --restart=OnFailure --schedule='*/10 * * * *'
) to start the cron job incorrectly ?
You are trying to override the image CMD
/ARG
with the 161/my-app
command (which seems not to be valid).
You should use:
oc run run-build --image=myimage --schedule='*/10 * * * *' \
--restart=OnFailure \
--command -- <YOUR COMMAND HERE>
Where run-build
is the name of your created cronjob.
If you want to use the default CMD
/ARG
built in the container image, just omit the --command
flag and its value.