c786a8ee |
% DOCKER(1) Docker User Manuals
% Docker Community |
e01baa6b |
% JUNE 2014 |
c786a8ee |
# NAME |
021ecb1d |
docker-exec - Run a command in a running container |
c786a8ee |
# SYNOPSIS
**docker exec** |
e6115a6c |
[**-d**|**--detach**] |
15aa2a66 |
[**--detach-keys**[=*[]*]] |
a2b529ea |
[**--help**] |
e6115a6c |
[**-i**|**--interactive**]
[**--privileged**]
[**-t**|**--tty**] |
2cce4791 |
[**-u**|**--user**[=*USER*]] |
e01baa6b |
CONTAINER COMMAND [ARG...] |
c786a8ee |
# DESCRIPTION
|
90326939 |
Run a process in a running container. |
c786a8ee |
|
44738747 |
The command started using `docker exec` will only run while the container's primary
process (`PID 1`) is running, and will not be restarted if the container is restarted.
If the container is paused, then the `docker exec` command will wait until the |
e01baa6b |
container is unpaused, and then run |
c786a8ee |
|
e01baa6b |
# OPTIONS |
c786a8ee |
**-d**, **--detach**=*true*|*false* |
15aa2a66 |
Override the key sequence for detaching a container. Format is a single character `[a-Z]` or `ctrl-<value>` where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
**--detach-keys**=""
Define the key sequence which detaches the container. |
c786a8ee |
|
a2b529ea |
**--help**
Print usage statement
|
c786a8ee |
**-i**, **--interactive**=*true*|*false* |
e01baa6b |
Keep STDIN open even if not attached. The default is *false*. |
c786a8ee |
|
03f65b3d |
**--privileged**=*true*|*false* |
90326939 |
Give the process extended [Linux capabilities](http://man7.org/linux/man-pages/man7/capabilities.7.html)
when running in a container. The default is *false*. |
03f65b3d |
|
90326939 |
Without this flag, the process run by `docker exec` in a running container has
the same capabilities as the container, which may be limited. Set
`--privileged` to give all capabilities to the process. |
03f65b3d |
|
c786a8ee |
**-t**, **--tty**=*true*|*false* |
e01baa6b |
Allocate a pseudo-TTY. The default is *false*.
|
2cce4791 |
**-u**, **--user**=""
Sets the username or UID used and optionally the groupname or GID for the specified command.
The followings examples are all valid:
--user [user | user:group | uid | uid:gid | user:gid | uid:group ]
Without this argument the command will be run as root in the container.
|
67e3ddb7 |
The **-t** option is incompatible with a redirection of the docker client
standard input.
|
e01baa6b |
# HISTORY
November 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> |