From d1af10fc51164211d20193e40b9b48b50b94934b Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 29 Jun 2019 15:33:24 -0400 Subject: [PATCH] feat: add labels to all build, commit, create, and run docker calls This will allow us to further filter containers and images by application when cleaning up containers. Refs #3515 --- plugins/app-json/internal-functions | 8 +-- plugins/apps/subcommands/clone | 4 +- plugins/apps/subcommands/rename | 4 +- plugins/build-env/pre-build-buildpack | 13 +++-- plugins/common/functions | 49 ++++++++++--------- plugins/repo/repo.go | 4 +- plugins/scheduler-docker-local/pre-deploy | 4 +- .../scheduler-docker-local/scheduler-deploy | 7 +-- plugins/scheduler-docker-local/scheduler-run | 3 +- 9 files changed, 59 insertions(+), 37 deletions(-) diff --git a/plugins/app-json/internal-functions b/plugins/app-json/internal-functions index 8fbbc6558..2392aea28 100755 --- a/plugins/app-json/internal-functions +++ b/plugins/app-json/internal-functions @@ -36,6 +36,9 @@ execute_script() { declare APP="$1" IMAGE_TAG="$2" PHASE_SCRIPT_KEY="$3" local IMAGE id SCRIPT_CMD + local DOCKER_COMMIT_LABEL_ARGS=("--change" "\"LABEL org.label-schema.schema-version=1.0\"" "--change" "\"LABEL org.label-schema.vendor=dokku\"" "--change" "\"LABEL com.dokku.app-name=$APP\"") + local DOCKER_RUN_LABEL_ARGS="--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=$APP" + IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG") if [[ "$PHASE_SCRIPT_KEY" == "release" ]]; then SCRIPT_CMD=$(get_release_cmd "$APP" "$IMAGE_TAG" 2>/dev/null || true) @@ -96,7 +99,7 @@ execute_script() { DOKKU_APP_SHELL="$(config_get "$APP" DOKKU_APP_SHELL || echo "$DOKKU_APP_SHELL")" [[ -z "$DOKKU_APP_SHELL" ]] && DOKKU_APP_SHELL="/bin/bash" - id=$("$DOCKER_BIN" run "$DOKKU_GLOBAL_RUN_ARGS" -e DOKKU_TRACE="$DOKKU_TRACE" --label=dokku_phase_script="${PHASE_SCRIPT_KEY}" -d -v "$CACHE_HOST_DIR:/cache" "${ARG_ARRAY[@]}" "$IMAGE" "$DOKKU_APP_SHELL" -c "$COMMAND") + id=$("$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" -e DOKKU_TRACE="$DOKKU_TRACE" --label=dokku_phase_script="${PHASE_SCRIPT_KEY}" -d -v "$CACHE_HOST_DIR:/cache" "${ARG_ARRAY[@]}" "$IMAGE" "$DOKKU_APP_SHELL" -c "$COMMAND") if test "$("$DOCKER_BIN" wait "$id")" -ne 0; then dokku_container_log_verbose_quiet "$id" dokku_log_fail "execution of '$SCRIPT_CMD' failed!" @@ -119,6 +122,5 @@ execute_script() { local DOCKER_COMMIT_ARGS="$DOCKER_COMMIT_ENTRYPOINT_CHANGE_ARG $DOCKER_COMMIT_CMD_CHANGE_ARG" fi - # shellcheck disable=SC2086 - eval "$DOCKER_BIN" commit $DOCKER_COMMIT_ARGS "$id" "$IMAGE" >/dev/null + eval "$DOCKER_BIN" commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "${DOCKER_COMMIT_ARGS[@]}" "$id" "$IMAGE" >/dev/null } diff --git a/plugins/apps/subcommands/clone b/plugins/apps/subcommands/clone index fe6ce5387..6cabc501d 100755 --- a/plugins/apps/subcommands/clone +++ b/plugins/apps/subcommands/clone @@ -22,6 +22,8 @@ apps_clone_cmd() { OLD_APP="$1" NEW_APP="$2" [[ -z "$OLD_APP" ]] && dokku_log_fail "Please specify an app to run the command on" + local DOCKER_RUN_LABEL_ARGS="--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=$NEW_APP" + is_valid_app_name "$OLD_APP" is_valid_app_name "$NEW_APP" apps_exists "$OLD_APP" >/dev/null 2>&1 || dokku_log_fail "App does not exist" @@ -44,7 +46,7 @@ apps_clone_cmd() { plugn trigger post-app-clone-setup "$OLD_APP" "$NEW_APP" if [[ -d "$NEW_CACHE_DIR" ]] && ! rmdir "$NEW_CACHE_DIR"; then - "$DOCKER_BIN" run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$NEW_CACHE_HOST_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache + "$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" --rm -v "$NEW_CACHE_HOST_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache fi rm -rf "$NEW_CACHE_DIR" diff --git a/plugins/apps/subcommands/rename b/plugins/apps/subcommands/rename index fcbdb88a6..8217f2afe 100755 --- a/plugins/apps/subcommands/rename +++ b/plugins/apps/subcommands/rename @@ -15,8 +15,10 @@ apps_rename_cmd() { local OLD_CACHE_DIR="$DOKKU_ROOT/$OLD_APP/cache" local OLD_CACHE_HOST_DIR="$DOKKU_HOST_ROOT/$OLD_APP/cache" + local DOCKER_RUN_LABEL_ARGS="--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=$OLD_APP" + if [[ -d "$OLD_CACHE_DIR" ]] && ! rmdir "$OLD_CACHE_DIR" >/dev/null 2>&1; then - "$DOCKER_BIN" run "$DOKKU_GLOBAL_RUN_ARGS" --rm -v "$OLD_CACHE_HOST_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache + "$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" --rm -v "$OLD_CACHE_HOST_DIR:/cache" "dokku/$OLD_APP" chmod 777 -R /cache fi rm -rf "$OLD_CACHE_DIR" apps_create "$NEW_APP" diff --git a/plugins/build-env/pre-build-buildpack b/plugins/build-env/pre-build-buildpack index 05f182163..55717e7df 100755 --- a/plugins/build-env/pre-build-buildpack +++ b/plugins/build-env/pre-build-buildpack @@ -10,6 +10,9 @@ build_env_pre_build_buildpack() { local APP="$1" local IMAGE id + local DOCKER_COMMIT_LABEL_ARGS=("--change" "LABEL org.label-schema.schema-version=1.0" "--change" "LABEL org.label-schema.vendor=dokku" "--change" "LABEL com.dokku.app-name=$APP") + local DOCKER_RUN_LABEL_ARGS="--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=$APP" + verify_app_name "$APP" IMAGE=$(get_app_image_name "$APP") @@ -19,14 +22,16 @@ build_env_pre_build_buildpack() { dokku_log_info1 "Adding BUILD_ENV to build environment..." # create build env files for use in buildpacks like this: # https://github.com/niteoweb/heroku-buildpack-buildout/blob/5879fa3418f7d8e079f1aa5816ba1adde73f4948/bin/compile#L34 - id=$(config_bundle --merged "$APP" | "$DOCKER_BIN" run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /tmp/env; cat | tar -x -C /tmp/env") + id=$(config_bundle --merged "$APP" | "$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /tmp/env; cat | tar -x -C /tmp/env") test "$("$DOCKER_BIN" wait "$id")" -eq 0 - "$DOCKER_BIN" commit "$id" "$IMAGE" >/dev/null + + "$DOCKER_BIN" commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$id" "$IMAGE" >/dev/null # create build env for 'old style' buildpacks and dokku plugins - id=$(config_export app "$APP" --format envfile --merged | "$DOCKER_BIN" run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "cat >> /app/.env") + id=$(config_export app "$APP" --format envfile --merged | "$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" -i -a stdin "$IMAGE" /bin/bash -c "cat >> /app/.env") test "$("$DOCKER_BIN" wait "$id")" -eq 0 - "$DOCKER_BIN" commit "$id" "$IMAGE" >/dev/null + + "$DOCKER_BIN" commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$id" "$IMAGE" >/dev/null } build_env_pre_build_buildpack "$@" diff --git a/plugins/common/functions b/plugins/common/functions index e7a679cb0..cf74a1ba7 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -371,6 +371,8 @@ copy_from_image() { local WORK_DIR="" verify_app_name "$APP" + local DOCKER_CREATE_LABEL_ARGS="--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=$APP" + if verify_image "$IMAGE"; then if ! is_abs_path "$SRC_FILE"; then if is_image_herokuish_based "$IMAGE"; then @@ -383,7 +385,7 @@ copy_from_image() { SRC_FILE="${WORKDIR}/${SRC_FILE}" fi fi - local CID=$("$DOCKER_BIN" create "$DOKKU_GLOBAL_RUN_ARGS" "$IMAGE") + local CID=$("$DOCKER_BIN" create "${DOCKER_CREATE_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" "$IMAGE") if ! "$DOCKER_BIN" cp "$CID:$SRC_FILE" "$DST_DIR"; then "$DOCKER_BIN" rm -f "$CID" &>/dev/null return 1 @@ -511,27 +513,29 @@ is_app_running() { dokku_build() { declare desc="build phase" + declare APP="$1" IMAGE_SOURCE_TYPE="$2" TMP_WORK_DIR="$3" source "$PLUGIN_AVAILABLE_PATH/config/functions" - local APP="$1" - local IMAGE_SOURCE_TYPE="$2" - local TMP_WORK_DIR="$3" - local IMAGE=$(get_app_image_name "$APP") - local cid verify_app_name "$APP" + local cid IMAGE=$(get_app_image_name "$APP") local DOKKU_APP_CACHE_DIR="$DOKKU_ROOT/$APP/cache" local DOKKU_APP_HOST_CACHE_DIR="$DOKKU_HOST_ROOT/$APP/cache" + local DOCKER_COMMIT_LABEL_ARGS=("--change" "LABEL org.label-schema.schema-version=1.0" "--change" "LABEL org.label-schema.vendor=dokku" "--change" "LABEL com.dokku.app-name=$APP") + local DOCKER_BUILD_LABEL_ARGS="--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=$APP" + local DOCKER_RUN_LABEL_ARGS="--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=$APP" + eval "$(config_export app "$APP")" pushd "$TMP_WORK_DIR" &>/dev/null case "$IMAGE_SOURCE_TYPE" in herokuish) DOKKU_IMAGE="$(config_get "$APP" DOKKU_IMAGE || echo "$DOKKU_IMAGE")" - cid=$(tar -c . | "$DOCKER_BIN" run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$DOKKU_IMAGE" /bin/bash -c "mkdir -p /app && tar -xC /app") + cid=$(tar -c . | "$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" -i -a stdin "$DOKKU_IMAGE" /bin/bash -c "mkdir -p /app && tar -xC /app") test "$("$DOCKER_BIN" wait "$cid")" -eq 0 - "$DOCKER_BIN" commit "$cid" "$IMAGE" >/dev/null + + "$DOCKER_BIN" commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$cid" "$IMAGE" >/dev/null [[ -d $DOKKU_APP_CACHE_DIR ]] || mkdir -p "$DOKKU_APP_CACHE_DIR" plugn trigger pre-build-buildpack "$APP" @@ -543,10 +547,11 @@ dokku_build() { declare -a ARG_ARRAY eval "ARG_ARRAY=($DOCKER_ARGS)" # shellcheck disable=SC2086 - cid=$("$DOCKER_BIN" run $DOKKU_GLOBAL_RUN_ARGS -d -v $DOKKU_APP_HOST_CACHE_DIR:/cache -e CACHE_PATH=/cache "${ARG_ARRAY[@]}" $IMAGE /build) + cid=$("$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" -d -v $DOKKU_APP_HOST_CACHE_DIR:/cache -e CACHE_PATH=/cache "${ARG_ARRAY[@]}" $IMAGE /build) "$DOCKER_BIN" attach "$cid" test "$("$DOCKER_BIN" wait "$cid")" -eq 0 - "$DOCKER_BIN" commit "$cid" "$IMAGE" >/dev/null + + "$DOCKER_BIN" commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$cid" "$IMAGE" >/dev/null plugn trigger post-build-buildpack "$APP" ;; @@ -573,8 +578,7 @@ dokku_build() { declare -a ARG_ARRAY eval "ARG_ARRAY=($DOCKER_ARGS)" - # shellcheck disable=SC2086 - "$DOCKER_BIN" build "${ARG_ARRAY[@]}" $DOKKU_DOCKER_BUILD_OPTS -t $IMAGE . + "$DOCKER_BIN" build "${DOCKER_BUILD_LABEL_ARGS[@]}" "${ARG_ARRAY[@]}" "${DOKKU_DOCKER_BUILD_OPTS[@]}" -t $IMAGE . plugn trigger post-build-dockerfile "$APP" ;; @@ -587,27 +591,28 @@ dokku_build() { dokku_release() { declare desc="release phase" + declare APP="$1" IMAGE_SOURCE_TYPE="$2" IMAGE_TAG="$3" source "$PLUGIN_AVAILABLE_PATH/config/functions" - local APP="$1" - local IMAGE_SOURCE_TYPE="$2" - local IMAGE_TAG="$3" - local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG") - local cid - verify_app_name "$APP" + local cid IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG") + + local DOCKER_COMMIT_LABEL_ARGS=("--change" "LABEL org.label-schema.schema-version=1.0" "--change" "LABEL org.label-schema.vendor=dokku" "--change" "LABEL com.dokku.app-name=$APP") + local DOCKER_RUN_LABEL_ARGS="--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=$APP" case "$IMAGE_SOURCE_TYPE" in herokuish) plugn trigger pre-release-buildpack "$APP" "$IMAGE_TAG" if [[ -n $(config_export global) ]]; then - cid=$(config_export global | "$DOCKER_BIN" run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh") + cid=$(config_export global | "$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh") test "$("$DOCKER_BIN" wait "$cid")" -eq 0 - "$DOCKER_BIN" commit "$cid" "$IMAGE" >/dev/null + + "$DOCKER_BIN" commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$cid" "$IMAGE" >/dev/null fi if [[ -n $(config_export app "$APP") ]]; then - cid=$(config_export app "$APP" | "$DOCKER_BIN" run "$DOKKU_GLOBAL_RUN_ARGS" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh") + cid=$(config_export app "$APP" | "$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" -i -a stdin "$IMAGE" /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/01-app-env.sh") test "$("$DOCKER_BIN" wait "$cid")" -eq 0 - "$DOCKER_BIN" commit "$cid" "$IMAGE" >/dev/null + + "$DOCKER_BIN" commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$cid" "$IMAGE" >/dev/null fi plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG" ;; diff --git a/plugins/repo/repo.go b/plugins/repo/repo.go index c317e9380..a0c116fcb 100644 --- a/plugins/repo/repo.go +++ b/plugins/repo/repo.go @@ -1,6 +1,7 @@ package repo import ( + "fmt" "os" "strings" @@ -20,9 +21,10 @@ func PurgeCache(appName string) error { dokkuGlobalRunArgs := common.MustGetEnv("DOKKU_GLOBAL_RUN_ARGS") image := config.GetWithDefault(appName, "DOKKU_IMAGE", os.Getenv("DOKKU_IMAGE")) if info, _ := os.Stat(cacheDir); info != nil && info.IsDir() { + dockerLabelArgs := fmt.Sprintf("--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=%s", appName) purgeCacheCmd := common.NewShellCmd(strings.Join([]string{ common.DockerBin(), - "run --rm", dokkuGlobalRunArgs, + "run --rm", dockerLabelArgs, dokkuGlobalRunArgs, "-v", strings.Join([]string{cacheHostDir, ":/cache"}, ""), image, `find /cache -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} ;`}, " ")) purgeCacheCmd.Execute() diff --git a/plugins/scheduler-docker-local/pre-deploy b/plugins/scheduler-docker-local/pre-deploy index 244b65830..452b3880f 100755 --- a/plugins/scheduler-docker-local/pre-deploy +++ b/plugins/scheduler-docker-local/pre-deploy @@ -17,6 +17,8 @@ scheduler-docker-local-pre-deploy() { return fi + local DOCKER_RUN_LABEL_ARGS="--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=$APP" + IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG") DOKKU_APP_TYPE=$(config_get "$APP" DOKKU_APP_TYPE || true) @@ -42,7 +44,7 @@ scheduler-docker-local-pre-deploy() { fi # shellcheck disable=SC2086 - "$DOCKER_BIN" run $DOKKU_GLOBAL_RUN_ARGS "${ARG_ARRAY[@]}" $IMAGE /bin/bash -c "find $CONTAINER_PATHS -not -user $DOKKU_APP_USER -print0 | xargs -0 -r chown -R $DOKKU_APP_USER" || true + "$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" "${ARG_ARRAY[@]}" $IMAGE /bin/bash -c "find $CONTAINER_PATHS -not -user $DOKKU_APP_USER -print0 | xargs -0 -r chown -R $DOKKU_APP_USER" || true } scheduler-docker-local-pre-deploy "$@" diff --git a/plugins/scheduler-docker-local/scheduler-deploy b/plugins/scheduler-docker-local/scheduler-deploy index 8fd16640f..5df279ba4 100755 --- a/plugins/scheduler-docker-local/scheduler-deploy +++ b/plugins/scheduler-docker-local/scheduler-deploy @@ -18,6 +18,7 @@ scheduler-docker-local-scheduler-deploy() { rm -f "${DOKKU_LIB_ROOT}/data/scheduler-docker-local/$APP/failed-containers" + local DOCKER_RUN_LABEL_ARGS="--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=$APP" local DOKKU_DOCKER_STOP_TIMEOUT DOKKU_HEROKUISH DOKKU_NETWORK_BIND_ALL IMAGE DOKKU_HEROKUISH=false IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG") @@ -94,16 +95,16 @@ scheduler-docker-local-scheduler-deploy() { START_CMD=$(fn-scheduler-docker-local-extract-start-cmd "$APP" "$PROC_TYPE" "$START_CMD" "$DOKKU_HEROKUISH" "$DOKKU_PORT") if [[ "$DOKKU_NETWORK_BIND_ALL" == "false" ]]; then # shellcheck disable=SC2086 - cid=$("$DOCKER_BIN" run $DOKKU_GLOBAL_RUN_ARGS -d -e PORT=$DOKKU_PORT "${ARG_ARRAY[@]}" $IMAGE $START_CMD) + cid=$("$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" -d -e PORT=$DOKKU_PORT "${ARG_ARRAY[@]}" $IMAGE $START_CMD) else # shellcheck disable=SC2086 - cid=$("$DOCKER_BIN" run $DOKKU_GLOBAL_RUN_ARGS -d $DOKKU_DOCKER_PORT_ARGS -e PORT=$DOKKU_PORT "${ARG_ARRAY[@]}" $IMAGE $START_CMD) + cid=$("$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" -d $DOKKU_DOCKER_PORT_ARGS -e PORT=$DOKKU_PORT "${ARG_ARRAY[@]}" $IMAGE $START_CMD) fi else START_CMD=$(fn-scheduler-docker-local-extract-start-cmd "$APP" "$PROC_TYPE" "$START_CMD" "$DOKKU_HEROKUISH") # shellcheck disable=SC2086 - cid=$("$DOCKER_BIN" run $DOKKU_GLOBAL_RUN_ARGS -d "${ARG_ARRAY[@]}" $IMAGE $START_CMD) + cid=$("$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" -d "${ARG_ARRAY[@]}" $IMAGE $START_CMD) fi ipaddr=$(plugn trigger network-get-ipaddr "$APP" "$PROC_TYPE" "$cid") diff --git a/plugins/scheduler-docker-local/scheduler-run b/plugins/scheduler-docker-local/scheduler-run index 478a429a1..9cbf73c25 100755 --- a/plugins/scheduler-docker-local/scheduler-run +++ b/plugins/scheduler-docker-local/scheduler-run @@ -18,6 +18,7 @@ scheduler-docker-local-scheduler-run() { return fi + local DOCKER_RUN_LABEL_ARGS="--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=$APP" local IMAGE_TAG=$(get_running_image_tag "$APP") local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG") @@ -66,7 +67,7 @@ scheduler-docker-local-scheduler-run() { fi # shellcheck disable=SC2086 - "$DOCKER_BIN" run $DOKKU_GLOBAL_RUN_ARGS "${DOCKER_ARGS_ARRAY[@]}" $IMAGE $EXEC_CMD "$@" + "$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" "${DOCKER_ARGS_ARRAY[@]}" $IMAGE $EXEC_CMD "$@" } scheduler-docker-local-scheduler-run "$@"