Initialize web, api and database for this project. Web uses better-auth, paraglide, tailwind, shadcn components, and more. Not much else has been done.
23 lines
527 B
Go
23 lines
527 B
Go
package docker
|
|
|
|
import (
|
|
"context"
|
|
"github.com/moby/moby/api/types"
|
|
"github.com/moby/moby/client"
|
|
)
|
|
|
|
func NewDockerClient() (*client.Client, error) {
|
|
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return cli, nil
|
|
}
|
|
|
|
func ListContainers(ctx context.Context, cli *client.Client) ([]types.Container, error) {
|
|
containers, err := cli.ContainerList(ctx, types.ContainerListOptions{})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return containers, nil
|
|
} |