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
2024-02-11 19:31:11 -05:00
committed by GitHub
3 changed files with 13 additions and 1 deletions

View File

@@ -4,6 +4,10 @@ set -eo pipefail
has_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
return 1
fi

View File

@@ -28,7 +28,7 @@ fn-help-content() {
declare desc="return 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: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: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

View File

@@ -21,6 +21,10 @@ fn-run() {
export DOKKU_DISABLE_TTY=true
shift
;;
--force-tty)
export DOKKU_FORCE_TTY=true
shift
;;
--cron-id)
if [[ ! $2 ]]; then
dokku_log_warn "expected $1 to have an argument"
@@ -50,6 +54,10 @@ fn-run() {
esac
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"
local DOKKU_SCHEDULER=$(get_app_scheduler "$APP")