Upgrade docker sdk to moby (#491)

* Replace deprecated method

* Upgrade docker sdk to moby
This commit is contained in:
Stavros Panakakis
2021-09-07 14:03:13 +03:00
committed by GitHub
parent 94ec06a3fe
commit 3ee2975d76
17 changed files with 39 additions and 38 deletions

View File

@@ -14,13 +14,13 @@ import (
"strings"
"time"
client "docker.io/go-docker"
"docker.io/go-docker/api/types"
"docker.io/go-docker/api/types/container"
"docker.io/go-docker/api/types/network"
"docker.io/go-docker/api/types/swarm"
"docker.io/go-docker/api/types/volume"
"github.com/containerd/containerd/reference"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/api/types/volume"
"github.com/docker/docker/client"
"github.com/play-with-docker/play-with-docker/config"
)
@@ -315,7 +315,7 @@ func (d *docker) ContainerCreate(opts CreateContainerOpts) (err error) {
pidsLimit = int64(i)
}
}
h.Resources.PidsLimit = pidsLimit
h.Resources.PidsLimit = &pidsLimit
if memLimit := os.Getenv("MAX_MEMORY_MB"); memLimit != "" {
if i, err := strconv.Atoi(memLimit); err == nil {
@@ -344,7 +344,7 @@ func (d *docker) ContainerCreate(opts CreateContainerOpts) (err error) {
}
if config.ExternalDindVolume {
_, err = d.c.VolumeCreate(context.Background(), volume.VolumesCreateBody{
_, err = d.c.VolumeCreate(context.Background(), volume.VolumeCreateBody{
Driver: "xfsvol",
DriverOpts: map[string]string{
"size": opts.DindVolumeSize,
@@ -451,7 +451,9 @@ func (d *docker) ExecAttach(instanceName string, command []string, out io.Writer
if err != nil {
return 0, err
}
resp, err := d.c.ContainerExecAttach(context.Background(), e.ID, types.ExecConfig{AttachStdout: true, AttachStderr: true, Tty: true})
resp, err := d.c.ContainerExecAttach(context.Background(), e.ID, types.ExecStartCheck{
Tty: true,
})
if err != nil {
return 0, err
}

View File

@@ -8,8 +8,8 @@ import (
"net/url"
"time"
client "docker.io/go-docker"
"docker.io/go-docker/api"
"github.com/docker/docker/api"
"github.com/docker/docker/client"
"github.com/docker/go-connections/tlsconfig"
"github.com/play-with-docker/play-with-docker/pwd/types"
"github.com/play-with-docker/play-with-docker/router"

View File

@@ -7,7 +7,7 @@ import (
"sync"
"time"
client "docker.io/go-docker"
"github.com/docker/docker/client"
"github.com/play-with-docker/play-with-docker/pwd/types"
"github.com/play-with-docker/play-with-docker/storage"
)
@@ -37,7 +37,7 @@ func (f *localCachedFactory) GetForSession(session *types.Session) (DockerApi, e
}
}
c, err := client.NewEnvClient()
c, err := client.NewClientWithOpts()
if err != nil {
return nil, err
}

View File

@@ -5,8 +5,8 @@ import (
"net"
"time"
client "docker.io/go-docker"
"docker.io/go-docker/api/types"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/stretchr/testify/mock"
)