Browse code

expose RemovalInProgress in StateString #25652

Signed-off-by: timfeirg <kkcocogogo@gmail.com>

timfeirg authored on 2016/08/15 20:33:56
Showing 6 changed files
... ...
@@ -86,6 +86,10 @@ func (s *State) StateString() string {
86 86
 		return "running"
87 87
 	}
88 88
 
89
+	if s.RemovalInProgress {
90
+		return "removing"
91
+	}
92
+
89 93
 	if s.Dead {
90 94
 		return "dead"
91 95
 	}
... ...
@@ -101,6 +105,7 @@ func (s *State) StateString() string {
101 101
 func IsValidStateString(s string) bool {
102 102
 	if s != "paused" &&
103 103
 		s != "restarting" &&
104
+		s != "removing" &&
104 105
 		s != "running" &&
105 106
 		s != "dead" &&
106 107
 		s != "created" &&
... ...
@@ -2182,7 +2182,7 @@ _docker_ps() {
2182 2182
 			return
2183 2183
 			;;
2184 2184
 		status)
2185
-			COMPREPLY=( $( compgen -W "created dead exited paused restarting running" -- "${cur##*=}" ) )
2185
+			COMPREPLY=( $( compgen -W "created dead exited paused restarting running removing" -- "${cur##*=}" ) )
2186 2186
 			return
2187 2187
 			;;
2188 2188
 		volume)
... ...
@@ -340,7 +340,7 @@ __docker_complete_ps_filters() {
340 340
                 __docker_networks && ret=0
341 341
                 ;;
342 342
             (status)
343
-                status_opts=('created' 'dead' 'exited' 'paused' 'restarting' 'running')
343
+                status_opts=('created' 'dead' 'exited' 'paused' 'restarting' 'running' 'removing')
344 344
                 _describe -t status-filter-opts "Status Filter Options" status_opts && ret=0
345 345
                 ;;
346 346
             (volume)
... ...
@@ -117,6 +117,8 @@ This section lists each version from latest to oldest.  Each listing includes a
117 117
 [Docker Remote API v1.25](docker_remote_api_v1.25.md) documentation
118 118
 
119 119
 * `POST /containers/create` now takes `AutoRemove` in HostConfig, to enable auto-removal of the container on daemon side when the container's process exits.
120
+* `GET /containers/json` and `GET /containers/(id or name)/json` now return `"removing"` as a value for the `State.Status` field if the container is being removed. Previously, "exited" was returned as status.
121
+* `GET /containers/json` now accepts `removing` as a valid value for the `status` filter.
120 122
 
121 123
 ### v1.24 API changes
122 124
 
... ...
@@ -226,7 +226,7 @@ List containers
226 226
         sizes
227 227
 -   **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
228 228
   -   `exited=<int>`; -- containers with exit code of  `<int>` ;
229
-  -   `status=`(`created`|`restarting`|`running`|`paused`|`exited`|`dead`)
229
+  -   `status=`(`created`|`restarting`|`running`|`removing`|`paused`|`exited`|`dead`)
230 230
   -   `label=key` or `label="key=value"` of a container label
231 231
   -   `isolation=`(`default`|`process`|`hyperv`)   (Windows daemon only)
232 232
   -   `ancestor`=(`<image-name>[:<tag>]`,  `<image id>` or `<image@digest>`)
... ...
@@ -20,7 +20,7 @@ Options:
20 20
   -f, --filter value    Filter output based on conditions provided (default [])
21 21
                         - exited=<int> an exit code of <int>
22 22
                         - label=<key> or label=<key>=<value>
23
-                        - status=(created|restarting|running|paused|exited)
23
+                        - status=(created|restarting|removing|running|paused|exited)
24 24
                         - name=<string> a container's name
25 25
                         - id=<ID> a container's ID
26 26
                         - before=(<container-name>|<container-id>)
... ...
@@ -68,7 +68,7 @@ The currently supported filters are:
68 68
 * label (`label=<key>` or `label=<key>=<value>`)
69 69
 * name (container's name)
70 70
 * exited (int - the code of exited containers. Only useful with `--all`)
71
-* status (created|restarting|running|paused|exited|dead)
71
+* status (created|restarting|running|removing|paused|exited|dead)
72 72
 * ancestor (`<image-name>[:<tag>]`,  `<image id>` or `<image@digest>`) - filters containers that were created from the given image or a descendant.
73 73
 * before (container's id or name) - filters containers created before given id or name
74 74
 * since (container's id or name) - filters containers created since given id or name
... ...
@@ -158,7 +158,7 @@ Any of these events result in a `137` status:
158 158
 #### Status
159 159
 
160 160
 The `status` filter matches containers by status. You can filter using
161
-`created`, `restarting`, `running`, `paused`, `exited` and `dead`. For example,
161
+`created`, `restarting`, `running`, `removing`, `paused`, `exited` and `dead`. For example,
162 162
 to filter for `running` containers:
163 163
 
164 164
 ```bash