MCPcopy Create free account
hub / github.com/coder/envbox / dockerRuntimes

Function dockerRuntimes

integration/gpu_test.go:151–162  ·  view source on GitHub ↗

dockerRuntimes returns the list of container runtimes available on the host. It does this by running `docker info` and parsing the output.

(t *testing.T)

Source from the content-addressed store, hash-verified

149// dockerRuntimes returns the list of container runtimes available on the host.
150// It does this by running `docker info` and parsing the output.
151func dockerRuntimes(t *testing.T) []string {
152 t.Helper()
153
154 ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
155 defer cancel()
156
157 cmd := exec.CommandContext(ctx, "docker", "info", "--format", "{{ range $k, $v := .Runtimes}}{{ println $k }}{{ end }}")
158 out, err := cmd.CombinedOutput()
159 require.NoError(t, err, "failed to get docker runtimes: %s", out)
160 raw := strings.TrimSpace(string(out))
161 return strings.Split(raw, "\n")
162}
163
164// outerFiles returns the list of files in the outer container matching the
165// given pattern. It does this by running `ls -1` in the outer container.

Callers 1

TestDocker_NvidiaFunction · 0.85

Calls 2

CombinedOutputMethod · 0.80
CommandContextMethod · 0.65

Tested by

no test coverage detected