github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/docs/reference/commandline/exec.md (about) 1 # docker exec 2 3 <!---MARKER_GEN_START--> 4 Execute a command in a running container 5 6 ### Aliases 7 8 `docker container exec`, `docker exec` 9 10 ### Options 11 12 | Name | Type | Default | Description | 13 |:----------------------|:---------|:--------|:-------------------------------------------------------| 14 | `-d`, `--detach` | | | Detached mode: run command in the background | 15 | `--detach-keys` | `string` | | Override the key sequence for detaching a container | 16 | `-e`, `--env` | `list` | | Set environment variables | 17 | `--env-file` | `list` | | Read in a file of environment variables | 18 | `-i`, `--interactive` | | | Keep STDIN open even if not attached | 19 | `--privileged` | | | Give extended privileges to the command | 20 | `-t`, `--tty` | | | Allocate a pseudo-TTY | 21 | `-u`, `--user` | `string` | | Username or UID (format: `<name\|uid>[:<group\|gid>]`) | 22 | `-w`, `--workdir` | `string` | | Working directory inside the container | 23 24 25 <!---MARKER_GEN_END--> 26