(prefix string)
| 196 | } |
| 197 | |
| 198 | func AllContainers(prefix string) []container.Summary { |
| 199 | cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) |
| 200 | x.Check(err) |
| 201 | |
| 202 | containers, err := cli.ContainerList(context.Background(), container.ListOptions{All: true}) |
| 203 | if err != nil { |
| 204 | log.Fatalf("While listing container: %v\n", err) |
| 205 | } |
| 206 | |
| 207 | var out []container.Summary |
| 208 | for _, c := range containers { |
| 209 | for _, name := range c.Names { |
| 210 | if strings.HasPrefix(name, "/"+prefix) { |
| 211 | out = append(out, c) |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | return out |
| 216 | } |
| 217 | |
| 218 | func ContainerAddrWithHost(name string, privatePort uint16, host string) string { |
| 219 | c := getContainer(name) |
no test coverage detected