mirror of
https://github.com/dokku/dokku.git
synced 2026-02-23 19:50:34 +01:00
refactor: deprecate the --rm and --rm-container flags
These flags are not commonly invoked by users, causing issues when cleaning up old containers. Rather than instruct users to use some random flag, just change the default to what is likely to be more common.
This commit is contained in:
@@ -3,7 +3,10 @@
|
||||
## Changes
|
||||
|
||||
- The network plugin can now set an `initial-network` for all containers on creation. This is a replacement for specifying the `--network` flag via the `docker-options` plugin. Please see the [network documentation](/docs/networking/network.md#attaching-an-app-to-a-network) for more information.
|
||||
- The `dokku run` command now always removes the ephemeral container on exit. Users that need a persistent container should instead specify a `console` process type in their `Procfile` specifying an available shell (usually either `bash` or `sh`) and scale that container appropriately.
|
||||
|
||||
|
||||
## Deprecations
|
||||
|
||||
- In previous versions of Dokku, the only way to specify a custom `Dockerfile` was to use the `docker-options` plugin to set the `--file` flag for a docker build. As of 0.25.0, the `builder-dockerfile:set` command should be used instead, as outlined in the [docs here](/docs/deployment/builders/dockerfiles.md#changingthe-dockerfile-location). Usage of the old method should be migrated to the new method.
|
||||
- The `--rm` and ``--rm-container` flags may be specified but no longer have any effect on `dokku run`.
|
||||
|
||||
@@ -94,7 +94,7 @@ The following config variables have special meanings and can be set in a variety
|
||||
| `DOKKU_CHECKS_URL` | `https://dokku.com/docs/deployment/zero-downtime-deploys/` | `/etc/environment` <br /> `~dokku/.dokkurc` <br /> `~dokku/.dokkurc/*` | Url displayed during deployment when no CHECKS file exists. |
|
||||
| `DOKKU_DETACH_CONTAINER` | none | `--detach` flag | Whether to detach a container started via `dokku run`. |
|
||||
| `DOKKU_QUIET_OUTPUT` | none | `--quiet` flag | Silences certain header output for `dokku` commands. |
|
||||
| `DOKKU_RM_CONTAINER` | none | `dokku config:set` <br /> `--rm-container` flag <br /> `--rm` flag | Whether to keep `dokku run` containers around or not. |
|
||||
| `DOKKU_RM_CONTAINER` | none | `dokku config:set` <br /> | Deprecated: Whether to keep `dokku run` containers around or not. |
|
||||
| `DOKKU_TRACE` | none | `dokku trace:on` <br /> `dokku trace:off` <br /> `--trace` flag | Turn on very verbose debugging. |
|
||||
| `DOKKU_APP_PROXY_TYPE` | `nginx` | `dokku proxy:set` | |
|
||||
| `DOKKU_APP_RESTORE` | `1` | `dokku config:set` <br /> `dokku ps:stop` | |
|
||||
|
||||
@@ -17,7 +17,6 @@ in order to avoid SSH interpretting Dokku arguments for itself.
|
||||
```
|
||||
--quiet suppress output headers
|
||||
--trace enable DOKKU_TRACE for current execution only
|
||||
--rm|--rm-container remove docker container after successful dokku run <app> <command>
|
||||
--force force flag. currently used in apps:destroy and other ":destroy" commands
|
||||
```
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ Sometimes it is necessary to run a one-off command under an application. Dokku m
|
||||
|
||||
## Usage
|
||||
|
||||
The `run` command can be used to run a one-off process for a specific command. This will start a new container and run the desired command within that container. Note that this container image will be stay around even after command completes. The container image will be the same container image as was used to start the currently deployed application.
|
||||
The `run` command can be used to run a one-off process for a specific command. This will start a new container and run the desired command within that container. This contianer will be removed after the process exits. The container image will be the same container image as was used to start the currently deployed application.
|
||||
|
||||
```shell
|
||||
# runs `ls -lah` in the `/app` directory of the application `node-js-app`
|
||||
@@ -29,23 +29,6 @@ console: bundle exec racksh
|
||||
dokku run my-app console
|
||||
```
|
||||
|
||||
If the container running the command should be removed after exit, the `--rm-container` or `--rm` global flags can be specified to remove the containers automatically:
|
||||
|
||||
```shell
|
||||
dokku --rm-container run node-js-app ls -lah
|
||||
dokku --rm run node-js-app ls -lah
|
||||
```
|
||||
|
||||
Alternatively, a global property can be set to always remove `run` containers.
|
||||
|
||||
```shell
|
||||
# don't keep `run` containers around
|
||||
dokku config:set --global DOKKU_RM_CONTAINER=1
|
||||
|
||||
# revert the above setting and keep containers around
|
||||
dokku config:unset --global DOKKU_RM_CONTAINER
|
||||
```
|
||||
|
||||
Containers may have specific labels attached. In order to avoid issues with dokku internals, do not use any labels beginning with either `com.dokku` or `org.label-schema`.
|
||||
|
||||
```shell
|
||||
|
||||
2
dokku
2
dokku
@@ -207,7 +207,7 @@ case "$1" in
|
||||
done
|
||||
|
||||
# New lines are blank echos for readability
|
||||
dokku_log_quiet "Usage: dokku [--quiet|--trace|--rm-container|--rm|--force] COMMAND <app> [command-specific-options]"
|
||||
dokku_log_quiet "Usage: dokku [--quiet|--trace|--force] COMMAND <app> [command-specific-options]"
|
||||
dokku_log_quiet ""
|
||||
dokku_log_quiet "Primary help options, type \"dokku COMMAND:help\" for more details, or dokku help --all to see all commands."
|
||||
dokku_log_quiet ""
|
||||
|
||||
@@ -439,7 +439,7 @@ parse_args() {
|
||||
export DOKKU_TRACE=1
|
||||
;;
|
||||
--rm-container | --rm)
|
||||
export DOKKU_RM_CONTAINER=1
|
||||
dokku_log_warn_quiet "Deprecated: all run containers are now removed on exit by default"
|
||||
;;
|
||||
--force)
|
||||
export DOKKU_APPS_FORCE_DELETE=1
|
||||
|
||||
@@ -33,7 +33,7 @@ func (t templateCommand) CronCommand() string {
|
||||
return t.AltCommand
|
||||
}
|
||||
|
||||
return fmt.Sprintf("dokku --rm run --cron-id %s %s %s", t.ID, t.App, t.Command)
|
||||
return fmt.Sprintf("dokku run --cron-id %s %s %s", t.ID, t.App, t.Command)
|
||||
}
|
||||
|
||||
func fetchCronEntries(appName string) ([]templateCommand, error) {
|
||||
|
||||
@@ -57,5 +57,6 @@ cmd-run() {
|
||||
declare cmd="run"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
|
||||
export DOKKU_RM_CONTAINER=1
|
||||
fn-run "$@"
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ teardown() {
|
||||
assert_output_contains "entrypoint script started with arguments touch /app/predeploy.test"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --rm run $TEST_APP ls /app/predeploy.test"
|
||||
run /bin/bash -c "dokku run $TEST_APP ls /app/predeploy.test"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
@@ -31,12 +31,12 @@ teardown() {
|
||||
assert_success
|
||||
assert_output '["/start","web"]'
|
||||
|
||||
run /bin/bash -c "dokku --rm run $TEST_APP ls /app/prebuild.test"
|
||||
run /bin/bash -c "dokku run $TEST_APP ls /app/prebuild.test"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku --rm run $TEST_APP ls /app/predeploy.test"
|
||||
run /bin/bash -c "dokku run $TEST_APP ls /app/predeploy.test"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
@@ -11,7 +11,6 @@ setup() {
|
||||
teardown() {
|
||||
rm -rf /home/dokku/$TEST_APP/tls
|
||||
destroy_app
|
||||
dokku config:unset --global DOKKU_RM_CONTAINER
|
||||
rm -f "$DOCKERFILE"
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@@ -175,24 +175,24 @@ EOF
|
||||
assert_success
|
||||
assert_output "true"
|
||||
|
||||
run /bin/bash -c "dokku --rm run $TEST_APP console"
|
||||
run /bin/bash -c "dokku run $TEST_APP console"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Hello world!"
|
||||
|
||||
run /bin/bash -c "dokku --rm run $TEST_APP printenv FOO"
|
||||
run /bin/bash -c "dokku run $TEST_APP printenv FOO"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku --rm config:set $TEST_APP FOO=bar"
|
||||
run /bin/bash -c "dokku config:set $TEST_APP FOO=bar"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "Releasing $TEST_APP"
|
||||
|
||||
run /bin/bash -c "dokku --rm run $TEST_APP printenv FOO"
|
||||
run /bin/bash -c "dokku run $TEST_APP printenv FOO"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
@@ -9,7 +9,6 @@ setup() {
|
||||
|
||||
teardown() {
|
||||
destroy_app
|
||||
dokku config:unset --global DOKKU_RM_CONTAINER
|
||||
global_teardown
|
||||
}
|
||||
|
||||
|
||||
@@ -9,59 +9,21 @@ setup() {
|
||||
|
||||
teardown() {
|
||||
destroy_app
|
||||
dokku config:unset --global DOKKU_RM_CONTAINER
|
||||
global_teardown
|
||||
}
|
||||
|
||||
@test "(core) run (with DOKKU_RM_CONTAINER/--rm-container)" {
|
||||
@test "(core) run" {
|
||||
deploy_app
|
||||
|
||||
run /bin/bash -c "dokku --rm-container run $TEST_APP echo $TEST_APP"
|
||||
run /bin/bash -c "dokku run $TEST_APP echo $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "docker ps -a -f 'status=exited' --no-trunc=true | grep \"/exec echo $TEST_APP\""
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku config:set --no-restart $TEST_APP DOKKU_RM_CONTAINER=1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --rm-container run $TEST_APP echo $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
run /bin/bash -c "docker ps -a -f 'status=exited' --no-trunc=true | grep \"/exec echo $TEST_APP\""
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku config:unset --no-restart $TEST_APP DOKKU_RM_CONTAINER"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku config:set --global DOKKU_RM_CONTAINER=1"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --rm-container run $TEST_APP echo $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
run /bin/bash -c "docker ps -a -f 'status=exited' --no-trunc=true | grep \"/exec echo $TEST_APP\""
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_failure
|
||||
|
||||
run /bin/bash -c "dokku config:unset --global DOKKU_RM_CONTAINER"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "(core) run (detached)" {
|
||||
|
||||
Reference in New Issue
Block a user