This PR uses the new syntax for commands introduced in Docker 1.13, making it a bit easier to understand just what a particular command is trying to do. This also pushes the long-form syntax for docker command flags, which are also easier to understand at a glance.
21 lines
685 B
Bash
Executable File
21 lines
685 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eo pipefail
|
|
[[ $DOKKU_TRACE ]] && set -x
|
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|
|
|
scheduler-docker-local-pre-restore() {
|
|
declare desc="scheduler-docker-local pre-restore plugin trigger"
|
|
declare trigger="scheduler-docker-local pre-restore"
|
|
declare DOKKU_SCHEDULER="$1"
|
|
|
|
if [[ "$DOKKU_SCHEDULER" != "docker-local" ]]; then
|
|
return
|
|
fi
|
|
|
|
# delete all "old" containers
|
|
# shellcheck disable=SC2046
|
|
"$DOCKER_BIN" container rm $("$DOCKER_BIN" container list --all --format "{{.Names}}" --filter "label=$DOKKU_CONTAINER_LABEL" --quiet | grep -E '(.+\..+\.[0-9]+\.[0-9]+$)') &>/dev/null || true
|
|
}
|
|
|
|
scheduler-docker-local-pre-restore "$@"
|