docker-db-backup/client.go

16 lines
394 B
Go
Raw Normal View History

2021-08-18 20:09:45 +02:00
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})
}