I've a docker-compose.yml which starts several containers.
One of which uses a Dockerimage file to install everything needed in that container.
I'd like to add a script which runs each time waiting for the interruption signals 0, 9 and 137.
Now, I'm trying to run the script as an Entrypoint in the Dockerimage file, but doesn't seems to work.
This is the content of the Dockerimage file :
RUN apt-get update && [...]
WORKDIR "/application"
ENTRYPOINT ["/bin/bash", "-c", "/application/scripts/cl.sh"]
Am I doing something wrong? Do I need to rebuild the containers with the following command?
docker-compose build
This is the content of the bash script cl.sh
#!/bin/bash
echo "HELLO HELLO HELLO HELLO"
trap 'echo "Exiting with a 137 signal."' 137 0 9
The only purpose of the script at the moment is testing everything work.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…