diff --git a/README.md b/README.md index 8080c30..ec522a8 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,9 @@ docker build \ $EMBARK_DOCKERFILE source <(curl $RUNNER) -run_embark --rm -- demo +run_embark demo cd embark_demo -run_embark --rm -- +run_embark ``` Review the @@ -62,6 +62,20 @@ EMBARK_DOCKER_RUN_OPTS_REPLACE=true run_embark [docker-run-opts] -- [command] ``` +By default `run.sh` invokes `docker run` with the +[`--rm`](https://docs.docker.com/engine/reference/run/#clean-up---rm) option, +making the embark container ephemeral, i.e. it will not persist on the docker +host's file system after the container exits. To override this behavior: + +``` shell +EMBARK_DOCKER_RUN_RM=false +run_embark [docker-run-opts] -- [command] +``` + +Note that if you have `EMBARK_DOCKER_RUN_OPTS_REPLACE=true`, then `--rm` would +need to be provided in `[docker-run-opts]`, i.e. `EMBARK_DOCKER_RUN_RM` will be +effectively ignored. + ### Shortcuts These are equivlent: diff --git a/run.sh b/run.sh index 88f2ac3..ea3666f 100755 --- a/run.sh +++ b/run.sh @@ -7,6 +7,7 @@ run_embark () { local EMBARK_DOCKER_RUN="${EMBARK_DOCKER_RUN}" local EMBARK_DOCKER_RUN_INTERACTIVE=${EMBARK_DOCKER_RUN_INTERACTIVE:-false} local EMBARK_DOCKER_RUN_OPTS_REPLACE=${EMBARK_DOCKER_RUN_OPTS_REPLACE:-false} + local EMBARK_DOCKER_RUN_RM=${EMBARK_DOCKER_RUN_RM:-true} local EMBARK_DOCKER_TAG="${EMBARK_DOCKER_TAG:-latest}" local -a run_opts=( @@ -38,6 +39,10 @@ run_embark () { "TERM" ) + if [[ $EMBARK_DOCKER_RUN_RM = true ]]; then + run_opts=( "${run_opts[@]}" "--rm" ) + fi + local txtbld=$(tput bold) local txtrst=$(tput sgr0)