Browse code

Expose the machine readable state of a container when listing containers

Updated documentation to reflect the new State property in the inspect remote api

Updated API changes for 1.23

Signed-off-by: Marius Gundersen <me@mariusgundersen.net>

Marius Gundersen authored on 2015/12/29 23:35:37
Showing 3 changed files
... ...
@@ -347,6 +347,7 @@ func (daemon *Daemon) transformContainer(container *container.Container, ctx *li
347 347
 		newC.Command = container.Path
348 348
 	}
349 349
 	newC.Created = container.Created.Unix()
350
+	newC.State = container.State.StateString()
350 351
 	newC.Status = container.State.String()
351 352
 	newC.HostConfig.NetworkMode = string(container.HostConfig.NetworkMode)
352 353
 	// copy networks to avoid races
... ...
@@ -96,6 +96,8 @@ This section lists each version from latest to oldest.  Each listing includes a
96 96
 
97 97
 [Docker Remote API v1.23](docker_remote_api_v1.23.md) documentation
98 98
 
99
+* `GET /containers/json` returns the state of the container, one of `created`, `restarting`, `running`, `paused`, `exited` or `dead`.
100
+
99 101
 
100 102
 ### v1.22 API changes
101 103
 
... ...
@@ -49,6 +49,7 @@ List containers
49 49
                  "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
50 50
                  "Command": "echo 1",
51 51
                  "Created": 1367854155,
52
+                 "State": "Exited",
52 53
                  "Status": "Exit 0",
53 54
                  "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
54 55
                  "Labels": {
... ...
@@ -81,6 +82,7 @@ List containers
81 81
                  "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
82 82
                  "Command": "echo 222222",
83 83
                  "Created": 1367854155,
84
+                 "State": "Exited",
84 85
                  "Status": "Exit 0",
85 86
                  "Ports": [],
86 87
                  "Labels": {},
... ...
@@ -110,6 +112,7 @@ List containers
110 110
                  "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
111 111
                  "Command": "echo 3333333333333333",
112 112
                  "Created": 1367854154,
113
+                 "State": "Exited",
113 114
                  "Status": "Exit 0",
114 115
                  "Ports":[],
115 116
                  "Labels": {},
... ...
@@ -139,6 +142,7 @@ List containers
139 139
                  "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
140 140
                  "Command": "echo 444444444444444444444444444444444",
141 141
                  "Created": 1367854152,
142
+                 "State": "Exited",
142 143
                  "Status": "Exit 0",
143 144
                  "Ports": [],
144 145
                  "Labels": {},