Upgrade docker sdk to moby (#491)
* Replace deprecated method * Upgrade docker sdk to moby
This commit is contained in:
committed by
GitHub
parent
94ec06a3fe
commit
3ee2975d76
@@ -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
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
|
||||
3
go.mod
3
go.mod
@@ -4,14 +4,13 @@ go 1.16
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.58.0 // indirect
|
||||
docker.io/go-docker v1.0.0
|
||||
github.com/Microsoft/go-winio v0.4.5 // indirect
|
||||
github.com/PuerkitoBio/purell v1.1.0 // indirect
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
||||
github.com/aws/aws-sdk-go v1.12.15
|
||||
github.com/containerd/containerd v1.0.0-beta.2
|
||||
github.com/docker/distribution v2.6.0-rc.1.0.20170726174610-edc3ab29cdff+incompatible // indirect
|
||||
github.com/docker/docker v1.4.2-0.20200309214505-aa6a9891b09c // indirect
|
||||
github.com/docker/docker v1.4.2-0.20200309214505-aa6a9891b09c
|
||||
github.com/docker/go-connections v0.3.0
|
||||
github.com/docker/go-units v0.3.2
|
||||
github.com/emicklei/go-restful v2.4.0+incompatible // indirect
|
||||
|
||||
4
go.sum
4
go.sum
@@ -30,8 +30,6 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo
|
||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
docker.io/go-docker v1.0.0 h1:VdXS/aNYQxyA9wdLD5z8Q8Ro688/hG8HzKxYVEVbE6s=
|
||||
docker.io/go-docker v1.0.0/go.mod h1:7tiAn5a0LFmjbPDbyTPOaTTOuG1ZRNXdPA6RvKY+fpY=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/Microsoft/go-winio v0.4.5 h1:U2XsGR5dBg1yzwSEJoP2dE2/aAXpmad+CNG2hE9Pd5k=
|
||||
@@ -189,6 +187,7 @@ github.com/juju/ratelimit v1.0.1 h1:+7AIFJVQ0EQgq/K9+0Krm7m530Du7tIz0METWzN0RgY=
|
||||
github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
@@ -245,6 +244,7 @@ github.com/satori/go.uuid v1.1.1-0.20170321230731-5bf94b69c6b6/go.mod h1:dA0hQrY
|
||||
github.com/shirou/gopsutil v2.16.13-0.20170924065440-6e221c482653+incompatible h1:gh3Hq7V5Zb8X2xk4T9FbHVi1m2Yo+oEIyjjJUiezVoY=
|
||||
github.com/shirou/gopsutil v2.16.13-0.20170924065440-6e221c482653+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
docker "docker.io/go-docker"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/play-with-docker/play-with-docker/config"
|
||||
"github.com/shirou/gopsutil/load"
|
||||
)
|
||||
@@ -15,7 +15,7 @@ func Ping(rw http.ResponseWriter, req *http.Request) {
|
||||
defer latencyHistogramVec.WithLabelValues("ping").Observe(float64(time.Since(time.Now()).Nanoseconds()) / 1000000)
|
||||
// Get system load average of the last 5 minutes and compare it against a threashold.
|
||||
|
||||
c, err := docker.NewEnvClient()
|
||||
c, err := client.NewClientWithOpts()
|
||||
|
||||
if err != nil {
|
||||
rw.WriteHeader(http.StatusInternalServerError)
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
dtypes "docker.io/go-docker/api/types"
|
||||
dtypes "github.com/docker/docker/api/types"
|
||||
"github.com/play-with-docker/play-with-docker/config"
|
||||
"github.com/play-with-docker/play-with-docker/docker"
|
||||
"github.com/play-with-docker/play-with-docker/pwd/types"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
dtypes "docker.io/go-docker/api/types"
|
||||
dtypes "github.com/docker/docker/api/types"
|
||||
"github.com/play-with-docker/play-with-docker/config"
|
||||
"github.com/play-with-docker/play-with-docker/docker"
|
||||
"github.com/play-with-docker/play-with-docker/event"
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
dtypes "docker.io/go-docker/api/types"
|
||||
dtypes "github.com/docker/docker/api/types"
|
||||
"github.com/play-with-docker/play-with-docker/config"
|
||||
"github.com/play-with-docker/play-with-docker/docker"
|
||||
"github.com/play-with-docker/play-with-docker/event"
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
dtypes "docker.io/go-docker/api/types"
|
||||
dtypes "github.com/docker/docker/api/types"
|
||||
"github.com/play-with-docker/play-with-docker/config"
|
||||
"github.com/play-with-docker/play-with-docker/docker"
|
||||
"github.com/play-with-docker/play-with-docker/event"
|
||||
|
||||
@@ -12,10 +12,10 @@ import (
|
||||
|
||||
"golang.org/x/crypto/ssh"
|
||||
|
||||
client "docker.io/go-docker"
|
||||
"docker.io/go-docker/api/types"
|
||||
"docker.io/go-docker/api/types/filters"
|
||||
"docker.io/go-docker/api/types/network"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/play-with-docker/play-with-docker/config"
|
||||
"github.com/play-with-docker/play-with-docker/router"
|
||||
@@ -60,7 +60,7 @@ func director(protocol router.Protocol, host string) (*router.DirectorInfo, erro
|
||||
|
||||
func connectNetworks() error {
|
||||
ctx := context.Background()
|
||||
c, err := client.NewEnvClient()
|
||||
c, err := client.NewClientWithOpts()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -91,7 +91,7 @@ func connectNetworks() error {
|
||||
}
|
||||
|
||||
func monitorNetworks() {
|
||||
c, err := client.NewEnvClient()
|
||||
c, err := client.NewClientWithOpts()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
dockerTypes "docker.io/go-docker/api/types"
|
||||
"docker.io/go-docker/api/types/swarm"
|
||||
dockerTypes "github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/play-with-docker/play-with-docker/docker"
|
||||
"github.com/play-with-docker/play-with-docker/event"
|
||||
"github.com/play-with-docker/play-with-docker/pwd/types"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"docker.io/go-docker/api/types/swarm"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/play-with-docker/play-with-docker/docker"
|
||||
"github.com/play-with-docker/play-with-docker/event"
|
||||
"github.com/play-with-docker/play-with-docker/pwd/types"
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
dockerTypes "docker.io/go-docker/api/types"
|
||||
"docker.io/go-docker/api/types/swarm"
|
||||
dockerTypes "github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/play-with-docker/play-with-docker/docker"
|
||||
"github.com/play-with-docker/play-with-docker/event"
|
||||
"github.com/play-with-docker/play-with-docker/pwd/types"
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
dockerTypes "docker.io/go-docker/api/types"
|
||||
dockerTypes "github.com/docker/docker/api/types"
|
||||
units "github.com/docker/go-units"
|
||||
lru "github.com/hashicorp/golang-lru"
|
||||
"github.com/play-with-docker/play-with-docker/docker"
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
dockerTypes "docker.io/go-docker/api/types"
|
||||
dockerTypes "github.com/docker/docker/api/types"
|
||||
"github.com/play-with-docker/play-with-docker/docker"
|
||||
"github.com/play-with-docker/play-with-docker/event"
|
||||
"github.com/play-with-docker/play-with-docker/pwd/types"
|
||||
|
||||
Reference in New Issue
Block a user