docker-entrypoint.sh 363 B

1234567891011121314151617
  1. #!/bin/sh
  2. trap cleanup SIGTERM
  3. cleanup()
  4. {
  5. echo Terminating $SERVICENAME
  6. docker rm -f $(docker ps -q -f label=ru.sdsys.subcontainer=$SERVICENAME)
  7. }
  8. SERVICENAME=$(docker inspect $HOSTNAME -f "{{index .Config.Labels \"com.docker.swarm.service.name\"}}")
  9. echo Starting $SERVICENAME
  10. exec "docker" "run" "-l" "ru.sdsys.subcontainer=$SERVICENAME" "$@" &
  11. wait