mirror of
https://github.com/kolaente/docker-db-backup.git
synced 2026-03-25 05:53:48 +01:00
16 lines
394 B
Go
16 lines
394 B
Go
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})
|
|
}
|