- image: httpd:alpine
- touch /tmp/ready
Why this yam gives crashloopbackoff? I am confused here shouldn’t it just create a file(/tmp/ready) inside the container and behave normally? The logs are not helpful either. ANyone help me understand?
I did not tell the container to exit. Why is it exiting?
i think container are short lived only till when the command get executed
But why, httpd is not an short lived image like busybox. Then why?
will checkout and let u know
Doesn’t matter what the image was that you used. You overrode the default command which is to run httpd and wait, with your own command
touch /tmp/ready which executed to completion, therefore the container exits.
Indeed, if we look image “httpd:alpine” dockerfile, we can see that default command is “httpd-foreground”. @Alistair Mackay: what will be the solution ? Do we have to rewrite new dockerfile including a step for creating “/tmp/ready” ? Or is there another way to provide additional commands after default one ?
command overrides whatever the default
entrypoint in the dockerfile was.
If you want an image that permanently overrides the default entrypoint, then yes, create a new dockerfile and build it
There is no real world scenario for a pod with a single container that runs only
touch. Such a pod will always exit immediately and be seen to be crashlooping
If you are trying to test whether httpd is ready to serve requests, then you would use an http readiness probe to call a page being served by httpd. When that returns a 200 status, then the pod is considered ready
@Alistair Mackay Thanks for feedback. Without this extra command, pod is running perfectly fine. I was just wondering how to find a workaround to help @Zakiya Jafrin but I think you already answered. Thanks
Thank you soo much. I got my answer. I was actually doing practice with readiness probe and command passing. @Alistair Mackay you explained perfectly
Hi @Gin Ichimaru fyr: