-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
41 lines (35 loc) · 877 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// For development debug only
package main
import (
"context"
"github.com/guionardo/gs-ops/internal/docker"
)
func main() {
s, err := docker.NewDockerService("unix:///run/user/1000/docker.sock")
if err != nil {
panic(err)
}
ctx := context.Background()
if err = s.DockerRunning(ctx); err != nil {
panic(err)
}
// cli, err := client.NewClientWithOpts(client.FromEnv)
// if err != nil {
// panic(err)
// }
// if v, err := cli.ServerVersion(ctx); err != nil {
// panic(err)
// } else {
// fmt.Printf("%v", v)
// }
// containers, err := cli.ContainerList(context.Background(), container.ListOptions{All: true})
// if err != nil {
// panic(err)
// }
// for _, ctr := range containers {
// fmt.Printf("%s %s\n", ctr.ID, ctr.Image)
// stat, _ := cli.ContainerStatsOneShot(ctx, ctr.ID)
// stat.Body.Read()
// fmt.Printf("%v\n", stat)
// }
}