1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #18966 from mariusGundersen/machine-readable-state

Expose the machine readable state of a container when listing containers
This commit is contained in:
Vincent Demeester 2016-02-03 16:41:45 +01:00
commit 98c4f0bbc3
3 changed files with 7 additions and 0 deletions

View file

@ -347,6 +347,7 @@ func (daemon *Daemon) transformContainer(container *container.Container, ctx *li
newC.Command = container.Path newC.Command = container.Path
} }
newC.Created = container.Created.Unix() newC.Created = container.Created.Unix()
newC.State = container.State.StateString()
newC.Status = container.State.String() newC.Status = container.State.String()
newC.HostConfig.NetworkMode = string(container.HostConfig.NetworkMode) newC.HostConfig.NetworkMode = string(container.HostConfig.NetworkMode)
// copy networks to avoid races // copy networks to avoid races

View file

@ -104,6 +104,8 @@ This section lists each version from latest to oldest. Each listing includes a
[Docker Remote API v1.23](docker_remote_api_v1.23.md) documentation [Docker Remote API v1.23](docker_remote_api_v1.23.md) documentation
* `GET /containers/json` returns the state of the container, one of `created`, `restarting`, `running`, `paused`, `exited` or `dead`.
### v1.22 API changes ### v1.22 API changes

View file

@ -49,6 +49,7 @@ List containers
"ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
"Command": "echo 1", "Command": "echo 1",
"Created": 1367854155, "Created": 1367854155,
"State": "Exited",
"Status": "Exit 0", "Status": "Exit 0",
"Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}], "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
"Labels": { "Labels": {
@ -81,6 +82,7 @@ List containers
"ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
"Command": "echo 222222", "Command": "echo 222222",
"Created": 1367854155, "Created": 1367854155,
"State": "Exited",
"Status": "Exit 0", "Status": "Exit 0",
"Ports": [], "Ports": [],
"Labels": {}, "Labels": {},
@ -110,6 +112,7 @@ List containers
"ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
"Command": "echo 3333333333333333", "Command": "echo 3333333333333333",
"Created": 1367854154, "Created": 1367854154,
"State": "Exited",
"Status": "Exit 0", "Status": "Exit 0",
"Ports":[], "Ports":[],
"Labels": {}, "Labels": {},
@ -139,6 +142,7 @@ List containers
"ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82", "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
"Command": "echo 444444444444444444444444444444444", "Command": "echo 444444444444444444444444444444444",
"Created": 1367854152, "Created": 1367854152,
"State": "Exited",
"Status": "Exit 0", "Status": "Exit 0",
"Ports": [], "Ports": [],
"Labels": {}, "Labels": {},