docker_container_control
Start, stop, or restart a single Docker Compose service and see the previous and current state, including whether the action changed anything. Timed-out stops show as killed with their exit code.
Instructions
Moves one service between states — start, stop, restart — and reports where it stood before and where it stands now, with changed saying whether the call did anything at all. A stop that ran out of time comes back killed with its exit code, never as a clean stop. The whole stack at once is docker_compose_control.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | start: bring the container up. stop: shut it down, giving it timeout seconds. restart: stop then start, keeping the same container. | |
| 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. | |
| timeout | No | Seconds the container gets to shut down before Docker kills it, for stop and restart. Default: 10. | |
| 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 |
|---|---|---|---|
| action | No | ||
| health | No | ||
| killed | No | ||
| 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 | ||
| changed | No | ||
| project | No | ||
| service | No | ||
| timeout | No | ||
| exit_code | No | ||
| state_after | No | ||
| state_before | No | ||
| restart_count | No |