mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 00:47:48 +08:00
use a consistent alias for the docker client package
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
b066ee1110
commit
d693e18c04
@ -43,6 +43,9 @@ linters-settings:
|
|||||||
# buildkit errdefs package (or vice-versa).
|
# buildkit errdefs package (or vice-versa).
|
||||||
- pkg: "github.com/containerd/errdefs"
|
- pkg: "github.com/containerd/errdefs"
|
||||||
alias: "cerrdefs"
|
alias: "cerrdefs"
|
||||||
|
# Use a consistent alias to prevent confusion with "github.com/moby/buildkit/client"
|
||||||
|
- pkg: "github.com/docker/docker/client"
|
||||||
|
alias: "dockerclient"
|
||||||
- pkg: "github.com/opencontainers/image-spec/specs-go/v1"
|
- pkg: "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
alias: "ocispecs"
|
alias: "ocispecs"
|
||||||
- pkg: "github.com/opencontainers/go-digest"
|
- pkg: "github.com/opencontainers/go-digest"
|
||||||
|
@ -3,12 +3,12 @@ package dockerutil
|
|||||||
import (
|
import (
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/docker/cli/cli/context/docker"
|
"github.com/docker/cli/cli/context/docker"
|
||||||
"github.com/docker/docker/client"
|
dockerclient "github.com/docker/docker/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ClientAPI represents an active docker API object.
|
// ClientAPI represents an active docker API object.
|
||||||
type ClientAPI struct {
|
type ClientAPI struct {
|
||||||
client.APIClient
|
dockerclient.APIClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClientAPI(cli command.Cli, ep string) (*ClientAPI, error) {
|
func NewClientAPI(cli command.Cli, ep string) (*ClientAPI, error) {
|
||||||
@ -36,7 +36,7 @@ func NewClientAPI(cli command.Cli, ep string) (*ClientAPI, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ca.APIClient, err = client.NewClientWithOpts(clientOpts...)
|
ca.APIClient, err = dockerclient.NewClientWithOpts(clientOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/docker/buildx/util/progress"
|
"github.com/docker/buildx/util/progress"
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/docker/docker/client"
|
dockerclient "github.com/docker/docker/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Client represents an active docker object.
|
// Client represents an active docker object.
|
||||||
@ -24,7 +24,7 @@ func NewClient(cli command.Cli) *Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// API returns a new docker API client.
|
// API returns a new docker API client.
|
||||||
func (c *Client) API(name string) (client.APIClient, error) {
|
func (c *Client) API(name string) (dockerclient.APIClient, error) {
|
||||||
if name == "" {
|
if name == "" {
|
||||||
name = c.cli.CurrentContext()
|
name = c.cli.CurrentContext()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user