diff --git a/pkg/commands/container.go b/pkg/commands/container.go index 5b42a5df..137fc25c 100644 --- a/pkg/commands/container.go +++ b/pkg/commands/container.go @@ -2,6 +2,7 @@ package commands import ( "context" + "github.com/docker/docker/api/types/container" "os/exec" "strconv" "strings" @@ -356,7 +357,7 @@ func (c *Container) Attach() (*exec.Cmd, error) { } // Top returns process information -func (c *Container) Top() (types.ContainerProcessList, error) { +func (c *Container) Top() (container.ContainerTopOKBody, error) { return c.Client.ContainerTop(context.Background(), c.ID, []string{}) } diff --git a/pkg/commands/docker.go b/pkg/commands/docker.go index 6408bb53..9da63616 100644 --- a/pkg/commands/docker.go +++ b/pkg/commands/docker.go @@ -21,6 +21,10 @@ import ( "github.com/sirupsen/logrus" ) +const ( + APIVersion = "1.20" +) + // DockerCommand is our main git interface type DockerCommand struct { Log *logrus.Entry @@ -61,7 +65,7 @@ func (c *DockerCommand) NewCommandObject(obj CommandObject) CommandObject { // NewDockerCommand it runs git commands func NewDockerCommand(log *logrus.Entry, osCommand *OSCommand, tr *i18n.TranslationSet, config *config.AppConfig, errorChan chan error) (*DockerCommand, error) { - cli, err := client.NewEnvClient() + cli, err := client.NewClientWithOpts(client.WithVersion(APIVersion)) if err != nil { return nil, err } diff --git a/pkg/commands/image.go b/pkg/commands/image.go index c19f7ed1..fb8cee76 100644 --- a/pkg/commands/image.go +++ b/pkg/commands/image.go @@ -2,6 +2,7 @@ package commands import ( "context" + "github.com/docker/docker/api/types/image" "strings" "github.com/docker/docker/api/types" @@ -41,7 +42,7 @@ func (i *Image) Remove(options types.ImageRemoveOptions) error { // Layer is a layer in an image's history type Layer struct { - types.ImageHistory + image.HistoryResponseItem } // GetDisplayStrings returns the array of strings describing the layer diff --git a/pkg/commands/service.go b/pkg/commands/service.go index 245e8a7c..59580ef4 100644 --- a/pkg/commands/service.go +++ b/pkg/commands/service.go @@ -1,6 +1,7 @@ package commands import ( + "github.com/docker/docker/api/types/container" "os/exec" "github.com/docker/docker/api/types" @@ -61,7 +62,7 @@ func (s *Service) Attach() (*exec.Cmd, error) { } // Top returns process information -func (s *Service) Top() (types.ContainerProcessList, error) { +func (s *Service) Top() (container.ContainerTopOKBody, error) { return s.Container.Top() }