<p>I have a script that I want to run using a dockerfile that looks like this:</p>
<pre><code>FROM debian:unstable-slim

RUN apt-get update &amp;&amp; apt-get install -y netcat-traditional httpie postgresql-client

COPY go.sh /tmp/go.sh

WORKDIR /tmp
CMD [&quot;bash&quot;, &quot;-c&quot;, &quot;/tmp/go.sh&quot;]
</code></pre>
<p>It works fine on local, but I need to deploy it as a kubernetes cronjob, I have a config file with something like this:</p>
<pre><code>script:
- docker build -t {github_enterprise_url/org/repo} .
</code></pre>
<p>And the build output seems ok:</p>
<pre><code>...
Step 3/7 : COPY go.sh /tmp/go.sh
 ---&gt; ab8d5227f65e
...
Successfully built e79162d90def
</code></pre>
<p>And for the cronjob yaml, among other things, I have something like this:</p>
<pre><code>spec:
  containers:
    - image: &gt;-
        ${ trigger.artifacts.?[type == 'docker'].?[name matches
        'org/repo'].![reference][0] }
</code></pre>
<p>the deploy then succeded but with this message:</p>
<pre><code>Cannot determine if job needs to be started: Too many missed start time (&gt; 100). Set or decrease .spec.startingDeadlineSeconds or check clock skew.
</code></pre>
<p>So I tried to run it manually like this:</p>
<pre><code>kubectl create job --from=cronjob/name name-manual-123
</code></pre>
<p>And when looking at the logs for the pod created, I get this:</p>
<pre><code>kubectl logs name-manual-123-ab1cd
bash: line 1: /tmp/go.sh: No such file or directory
</code></pre>
<p>any clue?</p>

anfbar
<p>The <code>/tmp</code> directory is generally intended for temporary file storage.  It's common to mount a RAM disk (<code>tmpfs</code>) there, and it's possible the Kubernetes setup does this without you noticing it.</p>
<p>You can address this by storing your script in a location that's on the default <code>PATH</code>, like <code>/usr/local/bin</code>:</p>
<pre class="lang-sh prettyprint-override"><code># /usr/local/bin, not /tmp
COPY go.sh /usr/local/bin

CMD [&quot;go.sh&quot;]
# will work when the script is executable; on $PATH (in /usr/local/bin);
# and has a correct shebang line
# #!/bin/sh
</code></pre>
