docker_exec
Execute shell commands inside a Docker container, with configurable stdin, working directory, environment, timeout, and acceptable exit codes. Supports background jobs for detached execution.
Instructions
Execute an intentional shell command inside a Docker container. Supports stdin, cwd, env, custom output limit, and acceptable exit codes. Set background=true to run a command detached and get a job_id; stdin is not allowed for background jobs. Use docker_exec_result to poll/wait and docker_exec_kill to stop or clean up.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory inside the container. | |
| env | No | Extra environment variables for the command. | |
| stdin | No | Text to write to the command's stdin. Not allowed when background=true. | |
| command | Yes | ||
| ok_codes | No | Exit codes to treat as success in addition to 0. | |
| container | Yes | Docker container name or id. | |
| background | No | Run the command detached and return a job_id instead of waiting for completion. | |
| timeout_ms | No | Timeout for non-background executions. | |
| max_output_bytes | No | Maximum stdout/stderr bytes to capture for non-background executions. |