MCPcopy
hub / github.com/moby/moby / ExampleClient_ContainerWait_withTimeout

Function ExampleClient_ContainerWait_withTimeout

client/container_wait_example_test.go:12–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10)
11
12func ExampleClient_ContainerWait_withTimeout() {
13 apiClient, err := client.New(
14 client.FromEnv,
15 client.WithUserAgent("my-application/1.0.0"),
16 )
17 if err != nil {
18 log.Fatal(err)
19 }
20
21 ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
22 defer cancel()
23 wait := apiClient.ContainerWait(ctx, "my_container_id", client.ContainerWaitOptions{
24 Condition: container.WaitConditionNotRunning,
25 })
26 if err := <-wait.Error; err != nil {
27 log.Fatal(err)
28 }
29}

Callers

nothing calls this directly

Calls 3

WithTimeoutMethod · 0.80
NewMethod · 0.65
ContainerWaitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…