From c848d9b22d43fd89121f8e1608b9c3126f347049 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 15 Jun 2017 17:24:41 +0200 Subject: [PATCH] Added usage example for -e for exec Signed-off-by: Vishnu Narayanan Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/exec.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/reference/commandline/exec.md b/docs/reference/commandline/exec.md index e2e5d607b9..2bfa74483c 100644 --- a/docs/reference/commandline/exec.md +++ b/docs/reference/commandline/exec.md @@ -76,6 +76,17 @@ $ docker exec -it ubuntu_bash bash This will create a new Bash session in the container `ubuntu_bash`. +Next, set an environment variable in the current bash session. + +```bash +$ docker exec -it -e VAR=1 ubuntu_bash bash +``` + +This will create a new Bash session in the container `ubuntu_bash` with environment +variable `$VAR` set to "1". Note that this environment variable will only be valid +on the current Bash session. + + ### Try to run `docker exec` on a paused container If the container is paused, then the `docker exec` command will fail with an error: