Last active
April 20, 2020 18:20
-
-
Save ChristianKniep/2b13b0a01ebd99a82e0b7ffb2710c624 to your computer and use it in GitHub Desktop.
Revisions
-
ChristianKniep revised this gist
Jun 9, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ func main() { for _, c := range containers { body, _ := cli.ContainerStats(context.Background(), c.ID, false) defer body.Close() content, _ := ioutil.ReadAll(body) fmt.Printf(string(content)) } } -
ChristianKniep created this gist
Jun 9, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ package main import ( "fmt" "io/ioutil" "github.com/docker/engine-api/client" "github.com/docker/engine-api/types" "golang.org/x/net/context" ) func main() { cli, err := client.NewEnvClient() if err != nil { panic(err) } options := types.ContainerListOptions{All: false} containers, err := cli.ContainerList(context.Background(), options) if err != nil { panic(err) } for _, c := range containers { body, _ := cli.ContainerStats(context.Background(), c.ID, false) defer body.Close() content, _ := ioutil.ReadAll(body) fmt.Printf(string(content)) } }