| 156 | } |
| 157 | |
| 158 | export async function listContainers(params: DockerCLIParameters | PartialExecParameters | DockerResolverParameters, all = false, labels: string[] = []) { |
| 159 | const filterArgs = []; |
| 160 | if (all) { |
| 161 | filterArgs.push('-a'); |
| 162 | } |
| 163 | for (const label of labels) { |
| 164 | filterArgs.push('--filter', `label=${label}`); |
| 165 | } |
| 166 | const result = await dockerCLI(params, 'ps', '-q', ...filterArgs); |
| 167 | return result.stdout |
| 168 | .toString() |
| 169 | .split(/\r?\n/) |
| 170 | .filter(s => !!s); |
| 171 | } |
| 172 | |
| 173 | export async function removeContainer(params: DockerCLIParameters | PartialExecParameters | DockerResolverParameters, nameOrId: string) { |
| 174 | const useEvents = !('cliVariant' in params && params.cliVariant === CLIVariant.Wslc); |