implement docker stop timeout. closes #2126 (#2148)

This commit is contained in:
Michael Hobbs
2016-04-26 18:06:55 -07:00
parent 28f83ab0d5
commit cb9efa3322
4 changed files with 22 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
source "$PLUGIN_AVAILABLE_PATH/config/functions"
apps_create() {
declare desc="verifies app name and creates an app"
@@ -34,11 +35,14 @@ apps_destroy() {
plugn trigger pre-delete "$APP" "$IMAGE_TAG"
local DOKKU_APP_CIDS=$(get_app_container_ids "$APP")
local cid
local DOKKU_DOCKER_STOP_TIMEOUT="$(config_get "$APP" DOKKU_DOCKER_STOP_TIMEOUT || true)"
[[ $DOKKU_DOCKER_STOP_TIMEOUT ]] && DOCKER_STOP_TIME_ARG="--time=${DOKKU_DOCKER_STOP_TIMEOUT}"
if [[ -n $DOKKU_APP_CIDS ]]; then
local cid
for cid in $DOKKU_APP_CIDS; do
docker stop "$cid" > /dev/null || true
# shellcheck disable=SC2086
docker stop $DOCKER_STOP_TIME_ARG "$cid" > /dev/null || true
docker rm "$cid" > /dev/null || true
done
fi