Reputation: 6122
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?
Right now, when I am trying to deploy a pod with no process running, I get this error :
Back-off restarting failed docker container Error syncing pod, skipping: failed to "StartContainer" for "containerName" with CrashLoopBackOff:
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.
Upvotes: 7
Views: 4805
Reputation: 13877
What you're trying to do sounds like an antipattern anyways you can do with with the sleep process e.g. like this:
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;" ]
You could then run your process BUT:
command
of the containerUpvotes: 7