docker-db-backup/client.go

16 lines
394 B
Go
Raw Permalink Normal View History

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