MCPcopy
hub / github.com/dgraph-io/dgraph / getContainer

Function getContainer

testutil/docker.go:177–196  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

175}
176
177func getContainer(name string) container.Summary {
178 cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
179 x.Check(err)
180
181 containers, err := cli.ContainerList(context.Background(), container.ListOptions{All: true})
182 if err != nil {
183 log.Fatalf("While listing container: %v\n", err)
184 }
185
186 q := fmt.Sprintf("/%s_%s_", DockerPrefix, name)
187 for _, c := range containers {
188 for _, n := range c.Names {
189 if !strings.HasPrefix(n, q) {
190 continue
191 }
192 return c
193 }
194 }
195 return container.Summary{}
196}
197
198func AllContainers(prefix string) []container.Summary {
199 cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())

Callers 3

ContainerAddrWithHostFunction · 0.85
DockerRunFunction · 0.85
DockerExecFunction · 0.85

Calls 2

CheckFunction · 0.92
FatalfMethod · 0.80

Tested by

no test coverage detected