File tree Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "context"
5
+ "fmt"
6
+ "github.com/ugurcsen/go-docker-compose-client/client"
7
+ "os"
8
+ )
9
+
10
+ func main () {
11
+ ctx , cancelCtx := context .WithCancel (context .Background ())
12
+ defer cancelCtx ()
13
+ cli , _ := client .NewClientWithContext (ctx , os .Getenv ("project_path" ))
14
+ stdout , err := cli .Down ()
15
+ if err != nil {
16
+ panic (err )
17
+ }
18
+ cli .Wait ()
19
+ fmt .Println (stdout .String ())
20
+ }
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "context"
5
+ "fmt"
6
+ "github.com/ugurcsen/go-docker-compose-client/client"
7
+ "os"
8
+ )
9
+
10
+ func main () {
11
+ ctx , cancelCtx := context .WithCancel (context .Background ())
12
+ defer cancelCtx ()
13
+ cli , _ := client .NewClientWithContext (ctx , os .Getenv ("project_path" ))
14
+ containers , err := cli .PsAll ()
15
+ if err != nil {
16
+ panic (err )
17
+ }
18
+ for _ , container := range containers {
19
+ fmt .Println (container .Labels ["com.docker.compose.service" ], container .State )
20
+ }
21
+ }
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "context"
5
+ "fmt"
6
+ "github.com/ugurcsen/go-docker-compose-client/client"
7
+ "os"
8
+ )
9
+
10
+ func main () {
11
+ ctx , cancelCtx := context .WithCancel (context .Background ())
12
+ defer cancelCtx ()
13
+ cli , _ := client .NewClientWithContext (ctx , os .Getenv ("project_path" ))
14
+ stdout , err := cli .Up ()
15
+ if err != nil {
16
+ panic (err )
17
+ }
18
+ cli .Wait ()
19
+ fmt .Println (stdout .String ())
20
+ }
You can’t perform that action at this time.
0 commit comments