mirror of
https://github.com/docker/cli.git
synced 2026-09-26 17:30:51 -04:00
Windows: Add isolation to ps filter
Signed-off-by: John Howard <jhoward@microsoft.com> Upstream-commit: 9c5814171ce7ab3af48867da36f4d374f804c4a6 Component: engine
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user