All Docker container statuses?
From their docs
One of created, restarting, running, removing, paused, exited, or dead
In my experience, immediately on starting a container, it's created
, then shortly after it's running
, then when it exits with a zero or non-zero exit code, it's exited
.
The logic by which the status summary is generated can be found in the Docker source code, in the file container/states.go
, l. 41ff.. Basically, you'll get one of the following:
- Up 1 day (paused)
- Restarting (123) 1 day ago
- Up 1 day
- Removal in Progress
- Dead
- Created
- Exited (123) 1 day ago
- (empty string)
In order to get a machine-readable output, I'd suggest using the /containers/:id/json
endpoint, which will return a data structure like the following:
"State": {
"Dead": false,
"Error": "",
"ExitCode": 0,
"FinishedAt": "0001-01-01T00:00:00Z",
"OOMKilled": false,
"Paused": false,
"Pid": 2593,
"Restarting": false,
"Running": true,
"StartedAt": "2015-12-26T19:22:38.616937722Z",
"Status": "running"
}