<p>We have a docker image. And am trying to deploy it using kubernetes. My doubt is can I deploy a pod with a single container but not run any process in the container while the container comes up? But run it after it starts. That is, after the container starts, go into the bash of the container, and run the process(lets say a java process)? Is that possible?</p>

<p>Right now, when I am trying to deploy a pod with no process running, I get this error : </p>

<blockquote>
  <p>Back-off restarting failed docker container
  Error syncing pod, skipping: failed to "StartContainer" for "containerName" with CrashLoopBackOff:</p>
</blockquote>

<p>But when I start the container with a java process, it works. Am not sure if its because of no process in container? Please guide.</p>

<p>What you're trying to do sounds like an antipattern anyways you can do with with the sleep process e.g. like this:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: app
spec:
  containers:
  - name: app-container
    image: app-image:version
    command: [ "/bin/bash", "-c", "--" ]
    args: [ "while true; do sleep 30; done;" ]
</code></pre>

<p>You could then run your process <strong>BUT</strong>:</p>

<ul>
<li>You container will not be bound to the seconds process and would not end when your second process ends</li>
<li>You have to do manual work</li>
<li>You could save if you'd just run your application in the <code>command</code> of the container</li>
</ul>
