mirror of
https://github.com/containrrr/watchtower.git
synced 2026-02-23 15:44:07 +01:00
feat: bump docker versions, remove deprecations
This commit is contained in:
parent
034de76896
commit
784f871878
6 changed files with 73 additions and 83 deletions
|
|
@ -7,9 +7,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
sdkClient "github.com/docker/docker/client"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
|
@ -109,7 +109,7 @@ func (client dockerClient) ListContainers(fn t.Filter) ([]t.Container, error) {
|
|||
filter := client.createListFilter()
|
||||
containers, err := client.api.ContainerList(
|
||||
bg,
|
||||
types.ContainerListOptions{
|
||||
container.ListOptions{
|
||||
Filters: filter,
|
||||
})
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ func (client dockerClient) StopContainer(c t.Container, timeout time.Duration) e
|
|||
} else {
|
||||
log.Debugf("Removing container %s", shortID)
|
||||
|
||||
if err := client.api.ContainerRemove(bg, idStr, types.ContainerRemoveOptions{Force: true, RemoveVolumes: client.RemoveVolumes}); err != nil {
|
||||
if err := client.api.ContainerRemove(bg, idStr, container.RemoveOptions{Force: true, RemoveVolumes: client.RemoveVolumes}); err != nil {
|
||||
if sdkClient.IsErrNotFound(err) {
|
||||
log.Debugf("Container %s not found, skipping removal.", shortID)
|
||||
return nil
|
||||
|
|
@ -303,7 +303,7 @@ func (client dockerClient) doStartContainer(bg context.Context, c t.Container, c
|
|||
name := c.Name()
|
||||
|
||||
log.Debugf("Starting container %s (%s)", name, t.ContainerID(creation.ID).ShortID())
|
||||
err := client.api.ContainerStart(bg, creation.ID, types.ContainerStartOptions{})
|
||||
err := client.api.ContainerStart(bg, creation.ID, container.StartOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -411,7 +411,7 @@ func (client dockerClient) RemoveImageByID(id t.ImageID) error {
|
|||
items, err := client.api.ImageRemove(
|
||||
context.Background(),
|
||||
string(id),
|
||||
types.ImageRemoveOptions{
|
||||
image.RemoveOptions{
|
||||
Force: true,
|
||||
})
|
||||
|
||||
|
|
@ -444,7 +444,7 @@ func (client dockerClient) ExecuteCommand(containerID t.ContainerID, command str
|
|||
clog := log.WithField("containerID", containerID)
|
||||
|
||||
// Create the exec
|
||||
execConfig := types.ExecConfig{
|
||||
execConfig := container.ExecOptions{
|
||||
Tty: true,
|
||||
Detach: false,
|
||||
Cmd: []string{"sh", "-c", command},
|
||||
|
|
@ -455,7 +455,7 @@ func (client dockerClient) ExecuteCommand(containerID t.ContainerID, command str
|
|||
return false, err
|
||||
}
|
||||
|
||||
response, attachErr := client.api.ContainerExecAttach(bg, exec.ID, types.ExecStartCheck{
|
||||
response, attachErr := client.api.ContainerExecAttach(bg, exec.ID, container.ExecStartOptions{
|
||||
Tty: true,
|
||||
Detach: false,
|
||||
})
|
||||
|
|
@ -464,7 +464,7 @@ func (client dockerClient) ExecuteCommand(containerID t.ContainerID, command str
|
|||
}
|
||||
|
||||
// Run the exec
|
||||
execStartCheck := types.ExecStartCheck{Detach: false, Tty: true}
|
||||
execStartCheck := container.ExecStartOptions{Detach: false, Tty: true}
|
||||
err = client.api.ContainerExecStart(bg, exec.ID, execStartCheck)
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/backend"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
cli "github.com/docker/docker/client"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/onsi/gomega/gbytes"
|
||||
|
|
@ -270,7 +271,7 @@ var _ = Describe("the client", func() {
|
|||
// API.ContainerExecCreate
|
||||
ghttp.CombineHandlers(
|
||||
ghttp.VerifyRequest("POST", HaveSuffix("containers/%v/exec", containerID)),
|
||||
ghttp.VerifyJSONRepresenting(types.ExecConfig{
|
||||
ghttp.VerifyJSONRepresenting(container.ExecOptions{
|
||||
User: user,
|
||||
Detach: false,
|
||||
Tty: true,
|
||||
|
|
@ -285,7 +286,7 @@ var _ = Describe("the client", func() {
|
|||
// API.ContainerExecStart
|
||||
ghttp.CombineHandlers(
|
||||
ghttp.VerifyRequest("POST", HaveSuffix("exec/%v/start", execID)),
|
||||
ghttp.VerifyJSONRepresenting(types.ExecStartCheck{
|
||||
ghttp.VerifyJSONRepresenting(container.ExecStartOptions{
|
||||
Detach: false,
|
||||
Tty: true,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import (
|
|||
t "github.com/beatkind/watchtower/pkg/types"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
I "github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
O "github.com/onsi/gomega"
|
||||
"github.com/onsi/gomega/ghttp"
|
||||
|
|
@ -262,12 +263,12 @@ func RemoveImageHandler(imagesWithParents map[string][]string) http.HandlerFunc
|
|||
image := parts[len(parts)-1]
|
||||
|
||||
if parents, found := imagesWithParents[image]; found {
|
||||
items := []types.ImageDeleteResponseItem{
|
||||
items := []I.DeleteResponse{
|
||||
{Untagged: image},
|
||||
{Deleted: image},
|
||||
}
|
||||
for _, parent := range parents {
|
||||
items = append(items, types.ImageDeleteResponseItem{Deleted: parent})
|
||||
items = append(items, I.DeleteResponse{Deleted: parent})
|
||||
}
|
||||
ghttp.RespondWithJSONEncoded(http.StatusOK, items)(w, r)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue