mirror of
https://kolaente.dev/konrad/docker-db-backup.git
synced 2026-01-10 02:50:08 +01:00
Add methods to get containers
This commit is contained in:
15
client.go
Normal file
15
client.go
Normal file
@@ -0,0 +1,15 @@
|
||||
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})
|
||||
}
|
||||
Reference in New Issue
Block a user