exec_in_container
Execute commands inside a running Docker container, returning exit codes and output. Configure user, environment variables, working directory, and terminal allocation.
Instructions
Run a command inside a running container.
Security: when any element of cmd is agent-controlled, use an exec-form argv list that does not
invoke a shell (e.g. ["python", "-V"], ["ls", path]). A string cmd, or a shell form like
["sh", "-c", template], interprets shell metacharacters in the untrusted parts.
args: id_or_name - The container id or name cmd - Command to execute (prefer exec-form argv, no shell, when any element is agent-controlled) stdout - Attach to stdout stderr - Attach to stderr stdin - Attach to stdin tty - Allocate a pseudo-TTY privileged - Run with extended privileges user - User to run the command as detach - Detach from the exec environment - Environment variables workdir - Working directory inside the container demux - Return stdout and stderr separately returns: dict - Mapping with exit_code and output keys
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cmd | Yes | ||
| tty | No | ||
| user | No | ||
| demux | No | ||
| stdin | No | ||
| detach | No | ||
| stderr | No | ||
| stdout | No | ||
| workdir | No | ||
| id_or_name | Yes | ||
| privileged | No | ||
| environment | No |