1DOCKER(1) JUNE 2014 DOCKER(1)
2
3
4
6 docker-exec - Run a command in a running container
7
8
9
11 docker exec [-d|--detach] [--detach-keys[=[]]] [-e|--env[=[]]] [--help]
12 [-i|--interactive] [--privileged] [-t|--tty] [-u|--user[=USER]]
13 CONTAINER COMMAND [ARG...]
14
15
16
18 Run a process in a running container.
19
20
21 The command started using docker exec will only run while the
22 container's primary process (PID 1) is running, and will not be
23 restarted if the container is restarted.
24
25
26 If the container is paused, then the docker exec command will wait
27 until the container is unpaused, and then run
28
29
30
32 -d, --detach=true|false
33 Detached mode: run command in the background. The default is false.
34
35
36 --detach-keys=""
37 Override the key sequence for detaching a container. Format is a
38 single character [a-Z] or ctrl-<value> where <value> is one of: a-z, @,
39 ^, [, , or _.
40
41
42 -e, --env=[]
43 Set environment variables
44
45
46 This option allows you to specify arbitrary environment variables that
47 are available for the command to be executed.
48
49
50 --help
51 Print usage statement
52
53
54 -i, --interactive=true|false
55 Keep STDIN open even if not attached. The default is false.
56
57
58 --privileged=true|false
59 Give the process extended Linux capabilities
60 ⟨http://man7.org/linux/man-pages/man7/capabilities.7.html⟩ when running
61 in a container. The default is false.
62
63
64 Without this flag, the process run by docker exec in a running
65 container has the same capabilities as the container, which may be
66 limited. Set --privileged to give all capabilities to the process.
67
68
69 -t, --tty=true|false
70 Allocate a pseudo-TTY. The default is false.
71
72
73 -u, --user=""
74 Sets the username or UID used and optionally the groupname or GID
75 for the specified command.
76
77
78 The followings examples are all valid:
79 --user [user | user:group | uid | uid:gid | user:gid | uid:group ]
80
81
82 Without this argument the command will be run as root in the container.
83
84
85 The -t option is incompatible with a redirection of the docker client
86 standard input.
87
88
89
91 November 2014, updated by Sven Dowideit ⟨SvenDowideit@home.org.au⟩
92
93
94
95Docker Community Docker User Manuals DOCKER(1)