Merge pull request #17534 from Microsoft/10662-filterhyperv
Windows: Add isolation to ps filter
This commit is contained in:
commit
9465d6ee6a
6 changed files with 33 additions and 0 deletions
|
@ -234,6 +234,11 @@ func includeContainerInList(container *Container, ctx *listContext) iterationAct
|
|||
return excludeContainer
|
||||
}
|
||||
|
||||
// Do not include container if the isolation mode doesn't match
|
||||
if excludeContainer == excludeByIsolation(container, ctx) {
|
||||
return excludeContainer
|
||||
}
|
||||
|
||||
// Do not include container if it's in the list before the filter container.
|
||||
// Set the filter container to nil to include the rest of containers after this one.
|
||||
if ctx.beforeContainer != nil {
|
||||
|
|
9
daemon/list_unix.go
Normal file
9
daemon/list_unix.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
// +build linux freebsd
|
||||
|
||||
package daemon
|
||||
|
||||
// excludeByIsolation is a platform specific helper function to support PS
|
||||
// filtering by Isolation. This is a Windows-only concept, so is a no-op on Unix.
|
||||
func excludeByIsolation(container *Container, ctx *listContext) iterationAction {
|
||||
return includeContainer
|
||||
}
|
16
daemon/list_windows.go
Normal file
16
daemon/list_windows.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
package daemon
|
||||
|
||||
import "strings"
|
||||
|
||||
// excludeByIsolation is a platform specific helper function to support PS
|
||||
// filtering by Isolation. This is a Windows-only concept, so is a no-op on Unix.
|
||||
func excludeByIsolation(container *Container, ctx *listContext) iterationAction {
|
||||
i := strings.ToLower(string(container.hostConfig.Isolation))
|
||||
if i == "" {
|
||||
i = "default"
|
||||
}
|
||||
if !ctx.filters.Match("isolation", i) {
|
||||
return excludeContainer
|
||||
}
|
||||
return includeContainer
|
||||
}
|
|
@ -94,6 +94,7 @@ This section lists each version from latest to oldest. Each listing includes a
|
|||
|
||||
[Docker Remote API v1.22](docker_remote_api_v1.22.md) documentation
|
||||
|
||||
* `GET /containers/json` supports filter `isolation` on Windows.
|
||||
|
||||
### v1.21 API changes
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ Query Parameters:
|
|||
- `exited=<int>`; -- containers with exit code of `<int>` ;
|
||||
- `status=`(`created`|`restarting`|`running`|`paused`|`exited`)
|
||||
- `label=key` or `label="key=value"` of a container label
|
||||
- `isolation=`(`default`|`hyperv`) (Windows daemon only)
|
||||
|
||||
Status Codes:
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ The currently supported filters are:
|
|||
* exited (int - the code of exited containers. Only useful with `--all`)
|
||||
* status (created|restarting|running|paused|exited)
|
||||
* ancestor (`<image-name>[:<tag>]`, `<image id>` or `<image@digest>`) - filters containers that were created from the given image or a descendant.
|
||||
* isolation (default|hyperv) (Windows daemon only)
|
||||
|
||||
|
||||
#### Label
|
||||
|
|
Loading…
Reference in a new issue