Docker · Arazzo Workflow
Docker Run a Command Inside a Running Container
Version 1.0.0
Confirm a container is running, create an exec instance, start it, and read back the command exit code.
Provider
Workflows
exec-command-in-container
Execute a command in a running container and capture its exit code.
Verifies the target container is running, creates an exec instance with the supplied command, starts it in attached mode, and inspects the exec instance to recover the exit code that the start call does not return.
1
confirmRunning
ContainerInspect
Confirm the container is running and not paused before creating the exec instance. Exec against a stopped or paused container is rejected with a 409.
2
createExec
ContainerExec
Create the exec instance with the supplied command, attaching stdout and stderr so the output is streamed back on start. This call only registers the command; nothing runs yet.
3
startExec
ExecStart
Run the exec instance in attached (non-detached) mode. The response streams the command output but carries no exit status, which is why the flow inspects the exec instance afterwards.
4
inspectExec
ExecInspect
Inspect the exec instance to recover the exit code and confirm the command has finished running. This is the only way to learn whether the command succeeded.