Command on starting container


I need to start a Jboss server when my container starts. When a container is created and then I log on it, I execute the command ./ successfully. This file was created by me and it is in /home/jboss directory. However, when I try to fill Rancher fields, the container starts and stops (CrashLoopBackOff).

Does anyone have any example of how to complete these Rancher fields?

Rancher version: 2.3.1

Thanks in advance.

You can view the logs from the container and see what the error is that is causing the crash. You might try using the full path to the script instead of using a relative path.

1 Like

Hi @shubbard343.

It doesn’t work too when I use the full path. It crashes so quickly that I can’t even see the container log.

Thanks for your reply.

Hi, everyone.

My command is definitely being executed. It’s awful! But when I put a while true code after starting JBoss server, my application runs as expected and the container keeps alive. Does anyone know a better solution? Thanks.

while true ; do
sleep 300

Does your JBoss process run in the foreground, or does it run as a background process? A Docker container needs to have whatever process you call run in the foreground. If that script ( starts another process, and then exits, then Kubernetes will think that the container has died and kill the container and start a new one.

1 Like

@shubbard343, thanks for your answer. It was very helpful. The process was really running in background and I am going to change how it works. :slight_smile:

This is the answer, and I think it is something that trips everyone up at some point in their K8s journey.

1 Like