Docker Community Forums

Share and learn in the Docker community.

SIGTERM not trapped in my CMD script


(Fvaltat) #1


I have a dockerfile, running a script that start a database and is supposed to trap SIGTERM signal to stop the database before stopping the container.

I run this command:
CMD sysctl -p ; /bin/su - oracle -c “exec /u01/app/oracle/scripts/”

the script ends with a tail on a log to make it permanent.

When I do a run command, when I want to exit the tail command with ^C, it stops the database and stop the container.
then I use the start command, it starts the container and the database but when I do stop the container, the container is killed and the SIGTERM signal is not trapped.

I don’t understand how to proceed to stop the database when stopping the container.
I have tried to use an ENTRYPOINT to run an exec “$@” too without any success.