Docker entrypoint example

From Torrid Bee, 6 Years ago, written in Bash, viewed 266 times.
URL https://paste.steamr.com/view/875c1640 Embed
Download Paste or View Raw
  1. #!/bin/sh
  2.  
  3. handle_signal (){
  4.         echo "received signal, passing SIGTERM"
  5.         kill -s SIGTERM `ps -o pid | tail -n + 2 | xargs`
  6. }
  7.  
  8. trap "handle_signal" SIGINT SIGTERM SIGHUP
  9.  
  10.  
  11. if [[ "$1" == "service" ]] ; then
  12.         # do your stuff
  13.         echo "Starting $1"
  14.  
  15. else
  16.         # Run custom command
  17.         echo "Running $@"
  18.         exec "$@"
  19. fi
  20.  

Reply to "Docker entrypoint example"

Here you can reply to the paste above