feat: add --no-tty flag to run and run:detached commands
This commit is contained in:
1 parent
350a84d253
commit
61d4b478ce
3 files changed
+17
No files matched your search
@@ -41,6 +41,14 @@ Containers may have specific labels attached. In order to avoid issues with dokk
|
|||||||
dokku --label=com.example.test-label=value run node-js-app ls -lah
|
dokku --label=com.example.test-label=value run node-js-app ls -lah
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Disabling TTY
|
||||||
|
|
||||||
|
One-off containers default to interactive mode where possible. To disable this behavior, specify the `--no-tty` flag:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
dokku run --no-tty node-js-app ls -lah
|
||||||
|
```
|
||||||
|
|
||||||
### Running a detached container
|
### Running a detached container
|
||||||
|
|
||||||
Finally, a container can be run in "detached" mode via the `run:detached` Dokku command. Running a process in detached mode will immediately return a `CONTAINER_ID`. It is up to the user to then further manage this container in whatever manner they see fit, as Dokku will *not* automatically terminate the container.
|
Finally, a container can be run in "detached" mode via the `run:detached` Dokku command. Running a process in detached mode will immediately return a `CONTAINER_ID`. It is up to the user to then further manage this container in whatever manner they see fit, as Dokku will *not* automatically terminate the container.
|
||||||
|
|||||||
@@ -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_DISABLE_TTY" == "true" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$(LC_ALL=C /usr/bin/tty || true)" == "not a tty" ]]; then
|
if [[ "$(LC_ALL=C /usr/bin/tty || true)" == "not a tty" ]]; then
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ fn-run() {
|
|||||||
SCHEDULER_ID+=("$arg")
|
SCHEDULER_ID+=("$arg")
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--no-tty)
|
||||||
|
export DOKKU_DISABLE_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"
|
||||||
@@ -67,6 +71,7 @@ cmd-run-detached() {
|
|||||||
[[ "$1" == "$cmd" ]] && shift 1
|
[[ "$1" == "$cmd" ]] && shift 1
|
||||||
|
|
||||||
export DOKKU_DETACH_CONTAINER=1
|
export DOKKU_DETACH_CONTAINER=1
|
||||||
|
export DOKKU_DISABLE_TTY=true
|
||||||
export DOKKU_RM_CONTAINER=1
|
export DOKKU_RM_CONTAINER=1
|
||||||
fn-run "$@"
|
fn-run "$@"
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user