123456789101112131415161718 |
- #!/bin/sh
- trap cleanup 0 1 2 3 6 15
- cleanup()
- {
- echo Terminating $SERVICENAME
- docker stop $(docker ps -q -f label=ru.sdsys.subcontainer=$SERVICENAME)
- docker rm -f $(docker ps -a -q -f label=ru.sdsys.subcontainer=$SERVICENAME)
- }
- SERVICENAME=$(docker inspect $HOSTNAME -f "{{index .Config.Labels \"com.docker.swarm.service.name\"}}")
- echo Starting $SERVICENAME
- exec "docker" "run" "-l" "ru.sdsys.subcontainer=$SERVICENAME" "$@" &
- wait
|