From this source: https://docs.docker.com/engine/api/v1.26/#operation/ContainerInspect
I think you can get the information you want by using:
GET /containers/{id}/json
In the json returned there are a lot of things, maybe the following is what you are searching for:
"State":
{
"Error": "",
"ExitCode": 9,
"FinishedAt": "2015-01-06T15:47:32.080254511Z",
"OOMKilled": false,
"Dead": false,
"Paused": false,
"Pid": 0,
"Restarting": false,
"Running": true,
"StartedAt": "2015-01-06T15:47:32.072697474Z",
"Status": "running"
},
edit:
from the GET /tasks
example, I see 2 different cases:
State: running
"ID": "0kzzo1i0y4jz6027t0k7aezc7",
"Status":
{
"Timestamp": "2016-06-07T21:07:31.290032978Z",
"State": "running",
"Message": "started",
"ContainerStatus":
{
"ContainerID": "e5d62702a1b48d01c3e02ca1e0212a250801fa8d67caca0b6f35919ebc12f035",
"PID": 677
}
},
"DesiredState": "running",
State: shutdown
"ID": "1yljwbmlr8er2waf8orvqpwms",
"Status":
{
"Timestamp": "2016-06-07T21:07:30.202183143Z",
"State": "shutdown",
"Message": "shutdown",
"ContainerStatus":
{
"ContainerID": "1cf8d63d18e79668b0004a4be4c6ee58cddfad2dae29506d8781581d0688a213"
}
},
"DesiredState": "shutdown",