Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -234,6 +234,11 @@ func includeContainerInList(container *Container, ctx *listContext) iterationAct |
| 234 | 234 |
return excludeContainer |
| 235 | 235 |
} |
| 236 | 236 |
|
| 237 |
+ // Do not include container if the isolation mode doesn't match |
|
| 238 |
+ if excludeContainer == excludeByIsolation(container, ctx) {
|
|
| 239 |
+ return excludeContainer |
|
| 240 |
+ } |
|
| 241 |
+ |
|
| 237 | 242 |
// Do not include container if it's in the list before the filter container. |
| 238 | 243 |
// Set the filter container to nil to include the rest of containers after this one. |
| 239 | 244 |
if ctx.beforeContainer != nil {
|
| 240 | 245 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,9 @@ |
| 0 |
+// +build linux freebsd |
|
| 1 |
+ |
|
| 2 |
+package daemon |
|
| 3 |
+ |
|
| 4 |
+// excludeByIsolation is a platform specific helper function to support PS |
|
| 5 |
+// filtering by Isolation. This is a Windows-only concept, so is a no-op on Unix. |
|
| 6 |
+func excludeByIsolation(container *Container, ctx *listContext) iterationAction {
|
|
| 7 |
+ return includeContainer |
|
| 8 |
+} |
| 0 | 9 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,16 @@ |
| 0 |
+package daemon |
|
| 1 |
+ |
|
| 2 |
+import "strings" |
|
| 3 |
+ |
|
| 4 |
+// excludeByIsolation is a platform specific helper function to support PS |
|
| 5 |
+// filtering by Isolation. This is a Windows-only concept, so is a no-op on Unix. |
|
| 6 |
+func excludeByIsolation(container *Container, ctx *listContext) iterationAction {
|
|
| 7 |
+ i := strings.ToLower(string(container.hostConfig.Isolation)) |
|
| 8 |
+ if i == "" {
|
|
| 9 |
+ i = "default" |
|
| 10 |
+ } |
|
| 11 |
+ if !ctx.filters.Match("isolation", i) {
|
|
| 12 |
+ return excludeContainer |
|
| 13 |
+ } |
|
| 14 |
+ return includeContainer |
|
| 15 |
+} |
| ... | ... |
@@ -94,6 +94,7 @@ This section lists each version from latest to oldest. Each listing includes a |
| 94 | 94 |
|
| 95 | 95 |
[Docker Remote API v1.22](docker_remote_api_v1.22.md) documentation |
| 96 | 96 |
|
| 97 |
+* `GET /containers/json` supports filter `isolation` on Windows. |
|
| 97 | 98 |
|
| 98 | 99 |
### v1.21 API changes |
| 99 | 100 |
|
| ... | ... |
@@ -116,6 +116,7 @@ Query Parameters: |
| 116 | 116 |
- `exited=<int>`; -- containers with exit code of `<int>` ; |
| 117 | 117 |
- `status=`(`created`|`restarting`|`running`|`paused`|`exited`) |
| 118 | 118 |
- `label=key` or `label="key=value"` of a container label |
| 119 |
+ - `isolation=`(`default`|`hyperv`) (Windows daemon only) |
|
| 119 | 120 |
|
| 120 | 121 |
Status Codes: |
| 121 | 122 |
|
| ... | ... |
@@ -51,6 +51,7 @@ The currently supported filters are: |
| 51 | 51 |
* exited (int - the code of exited containers. Only useful with `--all`) |
| 52 | 52 |
* status (created|restarting|running|paused|exited) |
| 53 | 53 |
* ancestor (`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) - filters containers that were created from the given image or a descendant. |
| 54 |
+* isolation (default|hyperv) (Windows daemon only) |
|
| 54 | 55 |
|
| 55 | 56 |
|
| 56 | 57 |
#### Label |