CrashLoopBackOff Pitfall #3
chris-kaiser-7
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
If you see you pod crashing immediately without logging anything and your getting CrashLoopBackOff error. The issue might be because the image is starting and completing quickly. You can check for this error by running
when adding the "--restart=Never" flag you can check if the pod crashed by simply using
and the status of your pod will be Completed instead of Error. Also the "--restart=Never" pairs well with the "--rm" flag which will delete your pod when it stops.
If you want to keep your pod alive even after the run command is completed you can add the -i flag. If you want to have STDIN and STDOUT (thru TTY) you can add the -t flag as well
putting it all together you can do something like this
to enter a bash terminal. The --command basically removes the ENTRYPOINT and CMD in the dockerfile and the "--" passes the "/bin/bash" command to the pod to run bash. you could replace "/bin/bash" with something like "/bin/echo hello" or "echo hello" if bin is in your PATH (which is should be). If your entrypoint is something like "echo" then if you don't use "--command" -- will append the the entrypoint command as args so you could do "-- hello world" and the entrypoint will turn into "echo hello world"
But if you don't want to do all that to get a shell you can simply do something like
Where openshift will spawn a pod from the deployment test with the entrypoint "/bin/sh" by default.
Beta Was this translation helpful? Give feedback.
All reactions