<p>i'm trying to download gzip file from a remote location, after download is complete the container Status changes to <code>Completed</code> then <code>CrashLoopBackOff</code>. the image below shows results of <code>kubectl log my-service</code> and <code>kubectl describe pod my-service</code> displays <code>CrashLoopBackOff restarting failed container.</code> </p>

<p>so i want this wget command to get executed during container initialization so i can gunzip and have the files accessed in a mounted volume. but this fails at container initialization </p>

<p><a href="https://i.stack.imgur.com/z8gAU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z8gAU.png" alt="enter image description here"></a></p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>      containers:
      - name: my-service
        image: docker.source.co.za/azp/my-service:1.0.0-SNAPSHOT
        imagePullPolicy: Always
        command:
          - wget
          - http://www.source.co.za/download/attachments/627674073/refpolicies.tar.gz
        volumeMounts:
        - name: my-service
          mountPath: /test/
      volumes:
      - name: my-service
        emptyDir: {}</code></pre>
</div>
</div>
</p>

Muzi Jack
<p>The container stops after the command is executed. Kubernetes expects the container to run forever.</p>

<p>You can configure as below to achieve the same</p>

<pre><code>command: ["/bin/sh","-c"]
args: ["wget url &amp;&amp; sleep infinity"]
</code></pre>

<p>sleep infinity makes the container run forever doing nothing.</p>
