Docker Compose
docker compose exec
Run a command in a running service container. -T disables pseudo-terminal allocation; it does not create a new service container. A failed probe can reflect a stopped client; confirm positive path and diagnose the failure.
Formal Syntax & Structure
docker syntaxdocker
docker compose exec [OPTIONS] SERVICE COMMAND [ARG...]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| -T | string | Disable pseudo-TTY |
| SERVICE | string | Running service |
| COMMAND | string | Command to execute |
Working Example
Example Snippetdocker
docker compose -f compose.yaml -p bm-v12-multi-service exec -T client wget -T 3 -qO- http://web:8080/