I am trying to create a docker container. He must run forever in the background. But whenever I press Ctrl + C or docker stop, it should close without wasting time.
My current code
#RUN trap 'echo $excode' EXIT HUP INT QUIT PIPE TERM
ENTRYPOINT while :; do read; done
#ENTRYPOINT trap "exit 1" SIGTERM SIGHUP && tail -f /dev/null & wait && exit 0
I can make it work forever, but for some reason my script does not receive TRAP events. Any clue how to fix it.
source
share