...
1
2
3 package runhcs
4
5 import (
6 "context"
7 "encoding/json"
8
9 irunhcs "github.com/Microsoft/hcsshim/internal/runhcs"
10 )
11
12
13
14 type ContainerState = irunhcs.ContainerState
15
16
17
18
19
20 func (r *Runhcs) List(context context.Context) ([]*ContainerState, error) {
21 data, err := cmdOutput(r.command(context, "list", "--format=json"), false)
22 if err != nil {
23 return nil, err
24 }
25 var out []*ContainerState
26 if err := json.Unmarshal(data, &out); err != nil {
27 return nil, err
28 }
29 return out, nil
30 }
31
View as plain text