Merge pull request #6614 from dokku/6606-tty-handling
Correct issue where --force-tty was not properly supported by run:detached calls
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
```
|
||||
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] [--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
|
||||
@@ -73,6 +73,12 @@ dokku run:detached node-js-app ls -lah
|
||||
# returns the ID of the new container
|
||||
```
|
||||
|
||||
To start a detached container with a tty, specify the `--force-tty` flag. Containers will still exit upon command termination, but can be attached to as long as they are running.
|
||||
|
||||
```shell
|
||||
dokku run:detached --force-tty node-js-app bash
|
||||
```
|
||||
|
||||
### Displaying one-off container logs
|
||||
|
||||
You can easily get logs of all one-off containers for an app using the `logs` command:
|
||||
|
||||
@@ -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|--force-tty] <app> <cmd>, Run a command in a new detached container using the current app image
|
||||
run:detached [-e|-env KEY=VALUE] [--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
|
||||
|
||||
@@ -5,6 +5,8 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
fn-run() {
|
||||
declare desc="runs command in container"
|
||||
declare CMD="$1"
|
||||
shift 1
|
||||
|
||||
declare APP=""
|
||||
local CRON_ID
|
||||
@@ -54,6 +56,10 @@ fn-run() {
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$CMD" == "run:detached" ]] && [[ "$DOKKU_FORCE_TTY" != "true" ]]; then
|
||||
export DOKKU_DISABLE_TTY=true
|
||||
fi
|
||||
|
||||
if [[ "$DOKKU_DISABLE_TTY" == "true" ]] && [[ "$DOKKU_FORCE_TTY" == "true" ]]; then
|
||||
dokku_log_fail "Cannot specify both --force-tty and --no-tty"
|
||||
fi
|
||||
@@ -70,7 +76,7 @@ cmd-run() {
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
|
||||
export DOKKU_RM_CONTAINER=1
|
||||
fn-run "$@"
|
||||
fn-run "$cmd" "$@"
|
||||
}
|
||||
|
||||
cmd-run-detached() {
|
||||
@@ -79,9 +85,8 @@ cmd-run-detached() {
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
|
||||
export DOKKU_DETACH_CONTAINER=1
|
||||
export DOKKU_DISABLE_TTY=true
|
||||
export DOKKU_RM_CONTAINER=1
|
||||
fn-run "$@"
|
||||
fn-run "$cmd" "$@"
|
||||
}
|
||||
|
||||
cmd-run-list() {
|
||||
|
||||
Reference in New Issue
Block a user