docker_exec
Run commands inside a Docker Compose service container and retrieve the exit code with stdout and stderr kept separate. Destructive commands are blocked until confirmed.
Instructions
Runs a command inside a service container and brings back its exit code, with stdout and stderr apart. exit_code null means the command never ran and reason says why; an empty stdout means it ran and said nothing. What destroys data is refused until the command carries # CONFIRMED-DESTRUCTIVE. Reading logs, asking a database and taking dumps have tools of their own.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user | No | Run as this user instead of the one the image declares. Default: the image user. | |
| command | Yes | The command line as it would be typed inside the container: "npm test", "alembic upgrade head". What destroys data — wiping a directory, dropping files — is refused until the line carries # CONFIRMED-DESTRUCTIVE. | |
| profile | No | Which Docker host, by profile name. Default: the profile marked as default. | |
| project | No | Which compose project. Default: the project of the working directory. A name matching nothing is an error, not a fall back to every container on the host. | |
| service | Yes | Service name as written in the compose file. | |
| workdir | No | Where inside the container the command runs. Default: working_dir of this service in the compose file, and the directory of the image where the file names none. | |
| interactive | No | Give the command a terminal. Both streams then arrive merged in stdout with stderr empty, and nothing is sent to its input: one call is not a dialogue. Default: false. | |
| compose_path | No | Where the compose file is: the file itself, or the directory holding it. Needed only when no container of the host carries the project label — a project that was never brought up there. A directory holding several compose files is refused with their names rather than guessed through. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| legend | No | What the words in this answer mean. A key names the field before the value — "state=running", "containers[].health=unhealthy" — and only the values this answer used are listed. | |
| reason | No | ||
| stderr | No | ||
| stdout | No | ||
| command | No | ||
| project | No | ||
| service | No | ||
| warnings | No | ||
| exit_code | No | ||
| truncated | No | ||
| clipped_bytes | No |