Merge pull request #6576 from Tashows/run_attachable

Create detached container with TTY enabled for attaching remote terminal.
This commit is contained in:
Jose Diaz-Gonzalez authored and GitHub committed 2024-02-11 19:31:11 -05:00
commit 321500a577
3 files changed
+13 -1

No files matched your search

+4
View File
@@ -4,6 +4,10 @@ set -eo pipefail
has_tty() { has_tty() {
declare desc="return 0 if we have a tty" declare desc="return 0 if we have a tty"
if [[ "$DOKKU_FORCE_TTY" == "true" ]]; then
return 0
fi
if [[ "$DOKKU_DISABLE_TTY" == "true" ]]; then if [[ "$DOKKU_DISABLE_TTY" == "true" ]]; then
return 1 return 1
fi fi
+1 -1
View File
@@ -28,7 +28,7 @@ fn-help-content() {
declare desc="return help content" declare desc="return help content"
cat <<help_content cat <<help_content
run [-e|--env KEY=VALUE] [--no-tty] <app> <cmd>, Run a command in a new container using the current app image run [-e|--env KEY=VALUE] [--no-tty] <app> <cmd>, Run a command in a new container using the current app image
run:detached [-e|-env KEY=VALUE] [--no-tty] <app> <cmd>, Run a command in a new detached container using the current app image run:detached [-e|-env KEY=VALUE] [--no-tty|--force-tty] <app> <cmd>, Run a command in a new detached container using the current app image
run:list [--format json|stdout] <app>, List all run containers for an app run:list [--format json|stdout] <app>, List all run containers for an app
run:logs <app|--container CONTAINER> [-h] [-t] [-n num] [-q], Display recent log output for run containers run:logs <app|--container CONTAINER> [-h] [-t] [-n num] [-q], Display recent log output for run containers
run:stop <app|--container CONTAINER>, Stops all run containers for an app or a specified run container run:stop <app|--container CONTAINER>, Stops all run containers for an app or a specified run container
+8
View File
@@ -21,6 +21,10 @@ fn-run() {
export DOKKU_DISABLE_TTY=true export DOKKU_DISABLE_TTY=true
shift shift
;; ;;
--force-tty)
export DOKKU_FORCE_TTY=true
shift
;;
--cron-id) --cron-id)
if [[ ! $2 ]]; then if [[ ! $2 ]]; then
dokku_log_warn "expected $1 to have an argument" dokku_log_warn "expected $1 to have an argument"
@@ -50,6 +54,10 @@ fn-run() {
esac esac
done done
if [[ "$DOKKU_DISABLE_TTY" == "true" ]] && [[ "$DOKKU_FORCE_TTY" == "true" ]]; then
dokku_log_fail "Cannot specify both --force-tty and --no-tty"
fi
verify_app_name "$APP" verify_app_name "$APP"
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP") local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")