Bump docker to v26 (#2289)

* chore: bump docker

* chore: bump more

* chore: update codes
This commit is contained in:
Jason Song
2024-04-11 23:29:02 +08:00
committed by GitHub
parent 5a9dd3d0ea
commit 2df924c509
3 changed files with 85 additions and 18 deletions

View File

@@ -22,6 +22,7 @@ import (
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/system"
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/stdcopy"
"github.com/go-git/go-billy/v5/helper/polyfill"
@@ -212,7 +213,7 @@ func GetDockerClient(ctx context.Context) (cli client.APIClient, err error) {
return cli, nil
}
func GetHostInfo(ctx context.Context) (info types.Info, err error) {
func GetHostInfo(ctx context.Context) (info system.Info, err error) {
var cli client.APIClient
cli, err = GetDockerClient(ctx)
if err != nil {
@@ -282,7 +283,7 @@ func (cr *containerReference) find() common.Executor {
if cr.id != "" {
return nil
}
containers, err := cr.cli.ContainerList(ctx, types.ContainerListOptions{
containers, err := cr.cli.ContainerList(ctx, container.ListOptions{
All: true,
})
if err != nil {
@@ -310,7 +311,7 @@ func (cr *containerReference) remove() common.Executor {
}
logger := common.Logger(ctx)
err := cr.cli.ContainerRemove(ctx, cr.id, types.ContainerRemoveOptions{
err := cr.cli.ContainerRemove(ctx, cr.id, container.RemoveOptions{
RemoveVolumes: true,
Force: true,
})
@@ -806,7 +807,7 @@ func (cr *containerReference) copyContent(dstPath string, files ...*FileEntry) c
func (cr *containerReference) attach() common.Executor {
return func(ctx context.Context) error {
out, err := cr.cli.ContainerAttach(ctx, cr.id, types.ContainerAttachOptions{
out, err := cr.cli.ContainerAttach(ctx, cr.id, container.AttachOptions{
Stream: true,
Stdout: true,
Stderr: true,
@@ -844,7 +845,7 @@ func (cr *containerReference) start() common.Executor {
logger := common.Logger(ctx)
logger.Debugf("Starting container: %v", cr.id)
if err := cr.cli.ContainerStart(ctx, cr.id, types.ContainerStartOptions{}); err != nil {
if err := cr.cli.ContainerStart(ctx, cr.id, container.StartOptions{}); err != nil {
return fmt.Errorf("failed to start container: %w", err)
}