adjust code to newer API

This commit is contained in:
Dawid Dziurla 2019-07-05 14:18:44 +02:00
parent 277681a0dc
commit bb319ddb59
No known key found for this signature in database
GPG key ID: 7B6D8368172E9B0B
4 changed files with 11 additions and 4 deletions

View file

@ -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{})
}

View file

@ -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
}

View file

@ -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

View file

@ -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()
}