.nh .TH podman\-exec(1) .SH NAME .PP podman\-exec \- Execute a command in a running container .SH SYNOPSIS .PP \fBpodman exec\fP [\fIoptions\fP] \fIcontainer\fP [\fIcommand\fP [\fIarg\fP ...]] .PP \fBpodman container exec\fP [\fIoptions\fP] \fIcontainer\fP [\fIcommand\fP [\fIarg\fP ...]] .SH DESCRIPTION .PP \fBpodman exec\fP executes a command in a running container. .SH OPTIONS .SS \fB\-\-detach\fP, \fB\-d\fP .PP Start the exec session, but do not attach to it. The command will run in the background and the exec session will be automatically removed when it completes. The \fBpodman exec\fP command will print the ID of the exec session and exit immediately after it starts. .SS \fB\-\-detach\-keys\fP=\fIsequence\fP .PP Specify the key sequence for detaching a container. Format is a single character \fB\fC[a\-Z]\fR or one or more \fB\fCctrl\-\fR characters where \fB\fC\fR is one of: \fB\fCa\-z\fR, \fB\fC@\fR, \fB\fC^\fR, \fB\fC[\fR, \fB\fC,\fR or \fB\fC\_\fR\&. Specifying "" will disable this feature. The default is \fIctrl\-p,ctrl\-q\fP\&. .SS \fB\-\-env\fP, \fB\-e\fP .PP You may specify arbitrary environment variables that are available for the command to be executed. .SS \fB\-\-env\-file\fP=\fIfile\fP .PP Read in a line delimited file of environment variables. .SS \fB\-\-interactive\fP, \fB\-i\fP=\fItrue|false\fP .PP When set to true, keep stdin open even if not attached. The default is \fIfalse\fP\&. .SS \fB\-\-latest\fP, \fB\-l\fP .PP Instead of providing the container name or ID, use the last created container. If you use methods other than Podman to run containers such as CRI\-O, the last started container could be from either of those methods. .PP The latest option is not supported on the remote client. .SS \fB\-\-preserve\-fds\fP=\fIN\fP .PP Pass down to the process N additional file descriptors (in addition to 0, 1, 2). The total FDs will be 3+N. .SS \fB\-\-privileged\fP .PP Give extended privileges to this container. The default is \fIfalse\fP\&. .PP By default, Podman containers are "unprivileged" and cannot, for example, modify parts of the operating system. This is because by default a container is only allowed limited access to devices. A "privileged" container is given the same access to devices as the user launching the container. .PP A privileged container turns off the security features that isolate the container from the host. Dropped Capabilities, limited devices, read/only mount points, Apparmor/SELinux separation, and Seccomp filters are all disabled. .PP Rootless containers cannot have more privileges than the account that launched them. .SS \fB\-\-tty\fP, \fB\-t\fP .PP Allocate a pseudo\-TTY. .SS \fB\-\-user\fP, \fB\-u\fP .PP Sets the username or UID used and optionally the groupname or GID for the specified command. The following examples are all valid: \-\-user [user | user:group | uid | uid:gid | user:gid | uid:group ] .SS \fB\-\-workdir\fP, \fB\-w\fP=\fIpath\fP .PP Working directory inside the container .PP The default working directory for running binaries within a container is the root directory (/). The image developer can set a different default with the WORKDIR instruction, which can be overridden when creating the container. .SH Exit Status .PP The exit code from \fB\fCpodman exec\fR gives information about why the command within the container failed to run or why it exited. When \fB\fCpodman exec\fR exits with a non\-zero code, the exit codes follow the \fB\fCchroot\fR standard, see below: .PP \fB125\fP The error is with Podman itself .PP .RS .nf $ podman exec \-\-foo ctrID /bin/sh; echo $? Error: unknown flag: \-\-foo 125 .fi .RE .PP \fB126\fP The \fIcontained command\fP cannot be invoked .PP .RS .nf $ podman exec ctrID /etc; echo $? Error: container\_linux.go:346: starting container process caused "exec: \\"/etc\\": permission denied": OCI runtime error 126 .fi .RE .PP \fB127\fP The \fIcontained command\fP cannot be found .PP .RS .nf $ podman exec ctrID foo; echo $? Error: container\_linux.go:346: starting container process caused "exec: \\"foo\\": executable file not found in $PATH": OCI runtime error 127 .fi .RE .PP \fBExit code\fP The \fIcontained command\fP exit code .PP .RS .nf $ podman exec ctrID /bin/sh \-c 'exit 3'; echo $? 3 .fi .RE .SH EXAMPLES .PP .RS .nf $ podman exec \-it ctrID ls $ podman exec \-it \-w /tmp myCtr pwd $ podman exec \-\-user root ctrID ls .fi .RE .SH SEE ALSO .PP podman(1), podman\-run(1) .SH HISTORY .PP December 2017, Originally compiled by Brent Baudebbaude@redhat.com \[la]mailto:bbaude@redhat.com\[ra]