Files
dokku/plugins/ps/subcommands/default
Jose Diaz-Gonzalez 785d9b4937 feat: allow setting DOCKER_BIN path for docker execution
This change allows operators to specify a DOCKER_BIN environment variable. This will specify a binary to run when executing docker, which is useful in cases where the 'docker' command being run must be modified in a way that would otherwise be invasive to Dokku, but minimalistic if done within a wrapper.
2019-05-29 00:46:19 -04:00

29 lines
864 B
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
[[ $DOKKU_TRACE ]] && set -x
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
ps_main_cmd() {
declare desc="shows running processes in all running app containers"
local cmd="ps"
dokku_log_warn "Deprecated: Please use ps:report"
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
local APP="$2"
verify_app_name "$APP"
! (is_deployed "$APP") && dokku_log_warn "App $APP has not been deployed" && exit 0
local DOKKU_APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids "$APP")
local CID
for CID in $DOKKU_APP_RUNNING_CONTAINER_IDS; do
has_tty && local DOKKU_RUN_OPTS="-i -t"
dokku_log_info1_quiet "running processes in container: $CID"
# shellcheck disable=SC2086
"$DOCKER_BIN" exec $DOKKU_RUN_OPTS $CID /bin/sh -c "ps auxwww"
done
}
ps_main_cmd "$@"