You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
394 B
Go
16 lines
394 B
Go
2 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"github.com/docker/docker/api/types"
|
||
|
"github.com/docker/docker/client"
|
||
|
)
|
||
|
|
||
|
func getClient() (*client.Client, error) {
|
||
|
return client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
|
||
|
}
|
||
|
|
||
|
func getContainers(c *client.Client) ([]types.Container, error) {
|
||
|
return c.ContainerList(context.Background(), types.ContainerListOptions{All: true})
|
||
|
}
|