1podman-exec(1)()                                              podman-exec(1)()
2
3
4

NAME

6       podman-exec - Execute a command in a running container
7
8

SYNOPSIS

10       podman exec [options] container [command [arg ...]]
11
12
13       podman container exec [options] container [command [arg ...]]
14
15

DESCRIPTION

17       podman exec executes a command in a running container.
18
19

OPTIONS

21       --detach-keys=sequence
22
23
24       Override the key sequence for detaching a container. Format is a single
25       character [a-Z] or ctrl-<value> where <value> is one of: a-z, @, ^,  [,
26       , or _.
27
28
29       --env, -e
30
31
32       You  may specify arbitrary environment variables that are available for
33       the command to be executed.
34
35
36       --interactive, -i=true|false
37
38
39       When set to true, keep stdin open even if not attached. The default  is
40       false.
41
42
43       --latest, -l
44
45
46       Instead  of  providing  the  container name or ID, use the last created
47       container. If you use methods other than Podman to run containers  such
48       as  CRI-O,  the  last  started  container could be from either of those
49       methods.
50
51
52       The latest option is not supported on the remote client.
53
54
55       --preserve-fds=N
56
57
58       Pass down to the process N additional file descriptors (in addition  to
59       0, 1, 2).  The total FDs will be 3+N.
60
61
62       --privileged
63
64
65       Give  the  process extended Linux capabilities when running the command
66       in container.
67
68
69       --tty, -t
70
71
72       Allocate a pseudo-TTY.
73
74
75       --user, -u
76
77
78       Sets the username or UID used and optionally the groupname or  GID  for
79       the  specified  command.   The following examples are all valid: --user
80       [user | user:group | uid | uid:gid | user:gid | uid:group ]
81
82
83       --workdir, -w=path
84
85
86       Working directory inside the container
87
88
89       The default working directory for running binaries within  a  container
90       is  the  root  directory  (/).  The image developer can set a different
91       default with the WORKDIR instruction, which can be overridden when cre‐
92       ating the container.
93
94

Exit Status

96       The  exit code from podman exec gives information about why the command
97       within the container failed to run or why it exited.  When podman  exec
98       exits  with a non-zero code, the exit codes follow the chroot standard,
99       see below:
100
101
102       125 if the error is with Podman itself
103
104
105              $ podman exec --foo ctrID /bin/sh; echo $?
106              Error: unknown flag: --foo
107              125
108
109
110
111       126 if the contained command cannot be invoked
112
113
114              $ podman exec ctrID /etc; echo $?
115              Error: container_linux.go:346: starting container process caused "exec: \"/etc\": permission denied": OCI runtime error
116              126
117
118
119
120       127 if the contained command cannot be found
121
122
123              $ podman exec ctrID foo; echo $?
124              Error: container_linux.go:346: starting container process caused "exec: \"foo\": executable file not found in $PATH": OCI runtime error
125              127
126
127
128
129       Exit code of contained command otherwise
130
131
132              $ podman exec ctrID /bin/sh -c 'exit 3'
133              # 3
134
135
136

EXAMPLES

138       $ podman exec -it ctrID ls $ podman exec -it -w /tmp myCtr pwd $ podman
139       exec --user root ctrID ls
140
141

SEE ALSO

143       podman(1), podman-run(1)
144
145

HISTORY

147       December  2017,  Originally  compiled  by  Brent Baudebbaude@redhat.com
148       ⟨mailto:bbaude@redhat.com⟩
149
150
151
152                                                              podman-exec(1)()
Impressum