Container exits due to the Entrypoint Shell script

Hi,

I have to run a shell script to create the DB tables when the container starts but it causes the container to exit otherwise it works fine.

Following is the last instruction in the DockerFile:

ENTRYPOINT [“/var/www/shell-script.sh”]

I added the exec /bin/bash; command at the end of the script but the application does not run in the browser.

  • How can I debug what is happening to fix the issue?
  • How can I keep the container running with the script so that the application also runs in the browser?

Thanks

You don’t tell us what your script does, but let me guess: it executes some commands and then exits. As soon as there is no process running in the foreground, the container has nothing more to do and is terminated. This means after your script has done its work it has to start your application in the foreground.

1 Like