<p>1) Trying to run <code>efg.py</code> script inside the container as an arg in the kubernetes deployment file.<br>
2) Inside the container the file is present in <code>/opt/abc/efg.py</code>.
<br>3) While running the deployment it is showing no such file or directory.<br>
4) These are the container spec:</p>

<pre><code>    spec: containers: 
       -name: abc
        image: &lt;full path here to the registry and image&gt;
        imagePullPolicy: Always
        env:
        - name: PYTHONPATH
          value: "/opt"
        args:
        - /bin/sh
        - -c
        - cd /opt/abc &amp;&amp; python3.6 efg.py
</code></pre>

<p>logs:</p>

<blockquote>
  <p>python3.6 :cant open the file : efg.py [errorno] no such file or directory exists.</p>
</blockquote>

<p>The location of <code>efg.py</code> in the container is <code>/opt/abc/efg.py</code>.</p>

<p>Requirements:
1) Need to run the <code>efg.py</code>.<br>
2) <code>egf.py</code> requires a log directory and a file to be created inside <code>/opt/abc/</code>. Something like this <code>/opt/abc/log/efg.log</code>.</p>

<p>a) either add mkdir in <code>Dockerfile</code> ("which is not working")<br>
  b) add it in the args</p>

<p>Posting @Nancy comments as community wiki answer to be more visible.</p>

<p>Solution: </p>

<p><strong>1)</strong> Make the directory during docker image build </p>

<p><strong>2)</strong> For running a script , give entry point in docker build or give it inside the deployment file in container specs as command: </p>

<pre><code>["/bin/bash"] args: [ "-c", "cd /opt/ &amp;&amp; python3.6 efg.py" ]
</code></pre>

<p>In addition, if you need a env variable to be exported inside the pod you can give it inside the deployment file. There are other ways, but this worked for OP. </p>
