mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
chore: update docker and compose Go dependencies to the latest versions
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
composetypes "github.com/compose-spec/compose-go/v2/types"
|
||||
"github.com/distribution/reference"
|
||||
"github.com/docker/cli/cli/config"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/build"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
dockerclient "github.com/docker/docker/client"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
@@ -76,7 +76,8 @@ func buildSingleService(ctx context.Context, dockerCli *dockerclient.Client, ser
|
||||
return "", fmt.Errorf("service %s has no build configuration", service.Name)
|
||||
}
|
||||
if service.Image == "" {
|
||||
return "", fmt.Errorf("service %s has no image specified; building services without image is not supported yet", service.Name)
|
||||
return "", fmt.Errorf("service %s has no image specified; building services without image is not supported yet",
|
||||
service.Name)
|
||||
}
|
||||
|
||||
buildContextPath := service.Build.Context
|
||||
@@ -88,7 +89,7 @@ func buildSingleService(ctx context.Context, dockerCli *dockerclient.Client, ser
|
||||
return "", fmt.Errorf("failed to create build context for service %s: %w", service.Name, err)
|
||||
}
|
||||
|
||||
buildOptions := types.ImageBuildOptions{
|
||||
buildOptions := build.ImageBuildOptions{
|
||||
// TODO: Support Dockerfiles outside the build context
|
||||
// See https://github.com/docker/compose/blob/cf89fd1aa1328d5af77658ccc5a1e1b29981ae80/pkg/compose/build_classic.go#L92
|
||||
Dockerfile: service.Build.Dockerfile,
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/go-connections/nat"
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ func (cli *Client) CreateContainerWithImagePull(
|
||||
ctx context.Context, name string, config *container.Config, hostConfig *container.HostConfig,
|
||||
) (container.CreateResponse, error) {
|
||||
resp, err := cli.ContainerCreate(ctx, config, hostConfig, nil, nil, name)
|
||||
if err == nil || !client.IsErrNotFound(err) {
|
||||
if err == nil || !errdefs.IsNotFound(err) {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
|
||||
@@ -772,7 +772,7 @@ type Image struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
// JSON serialised types.ImageInspect.
|
||||
// JSON serialised image.InspectResponse.
|
||||
Image []byte `protobuf:"bytes,2,opt,name=image,proto3" json:"image,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ message InspectImageResponse {
|
||||
|
||||
message Image {
|
||||
Metadata metadata = 1;
|
||||
// JSON serialised types.ImageInspect.
|
||||
// JSON serialised image.InspectResponse.
|
||||
bytes image = 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/psviderski/uncloud/internal/machine/docker"
|
||||
@@ -848,15 +847,15 @@ func newContainerRecordWithCaddyConfig(serviceName, ip, caddyConfig, machineID s
|
||||
return store.ContainerRecord{
|
||||
Container: api.ServiceContainer{
|
||||
Container: api.Container{
|
||||
ContainerJSON: types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
InspectResponse: container.InspectResponse{
|
||||
ContainerJSONBase: &container.ContainerJSONBase{
|
||||
ID: serviceName + "-" + ip, // Add ID for stable sorting
|
||||
State: &types.ContainerState{
|
||||
State: &container.State{
|
||||
Running: true,
|
||||
},
|
||||
Created: created.UTC().Format(time.RFC3339Nano),
|
||||
},
|
||||
NetworkSettings: &types.NetworkSettings{
|
||||
NetworkSettings: &container.NetworkSettings{
|
||||
Networks: map[string]*network.EndpointSettings{
|
||||
docker.NetworkName: {
|
||||
IPAddress: ip,
|
||||
@@ -975,15 +974,15 @@ func newContainerRecordWithPorts(serviceName, ip string, ports []string, machine
|
||||
return store.ContainerRecord{
|
||||
Container: api.ServiceContainer{
|
||||
Container: api.Container{
|
||||
ContainerJSON: types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
InspectResponse: container.InspectResponse{
|
||||
ContainerJSONBase: &container.ContainerJSONBase{
|
||||
ID: serviceName + "-" + ip, // Add ID for stable sorting
|
||||
State: &types.ContainerState{
|
||||
State: &container.State{
|
||||
Running: true,
|
||||
},
|
||||
Created: time.Now().UTC().Format(time.RFC3339Nano),
|
||||
},
|
||||
NetworkSettings: &types.NetworkSettings{
|
||||
NetworkSettings: &container.NetworkSettings{
|
||||
Networks: map[string]*network.EndpointSettings{
|
||||
docker.NetworkName: {
|
||||
IPAddress: ip,
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/psviderski/uncloud/internal/machine/docker"
|
||||
@@ -334,13 +333,13 @@ func TestGenerateJSONConfig(t *testing.T) {
|
||||
|
||||
func newContainer(ip string, ports ...string) api.ServiceContainer {
|
||||
portsLabel := strings.Join(ports, ",")
|
||||
return api.ServiceContainer{Container: api.Container{ContainerJSON: types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
State: &types.ContainerState{
|
||||
return api.ServiceContainer{Container: api.Container{InspectResponse: container.InspectResponse{
|
||||
ContainerJSONBase: &container.ContainerJSONBase{
|
||||
State: &container.State{
|
||||
Running: true,
|
||||
},
|
||||
},
|
||||
NetworkSettings: &types.NetworkSettings{
|
||||
NetworkSettings: &container.NetworkSettings{
|
||||
Networks: map[string]*network.EndpointSettings{
|
||||
docker.NetworkName: {
|
||||
IPAddress: ip,
|
||||
@@ -357,13 +356,13 @@ func newContainer(ip string, ports ...string) api.ServiceContainer {
|
||||
|
||||
func newContainerWithoutNetwork(ports ...string) api.ServiceContainer {
|
||||
portsLabel := strings.Join(ports, ",")
|
||||
return api.ServiceContainer{Container: api.Container{ContainerJSON: types.ContainerJSON{
|
||||
ContainerJSONBase: &types.ContainerJSONBase{
|
||||
State: &types.ContainerState{
|
||||
return api.ServiceContainer{Container: api.Container{InspectResponse: container.InspectResponse{
|
||||
ContainerJSONBase: &container.ContainerJSONBase{
|
||||
State: &container.State{
|
||||
Running: true,
|
||||
},
|
||||
},
|
||||
NetworkSettings: &types.NetworkSettings{
|
||||
NetworkSettings: &container.NetworkSettings{
|
||||
Networks: map[string]*network.EndpointSettings{
|
||||
"other-network": {
|
||||
IPAddress: "172.17.0.2",
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/mount"
|
||||
@@ -30,7 +31,7 @@ type DockerService struct {
|
||||
func (s *DockerService) Start(ctx context.Context) error {
|
||||
_, err := s.Client.ContainerInspect(ctx, s.Name)
|
||||
if err != nil {
|
||||
if !client.IsErrNotFound(err) {
|
||||
if !errdefs.IsNotFound(err) {
|
||||
return fmt.Errorf("inspect container %q: %w", s.Name, err)
|
||||
}
|
||||
if err = s.startNewContainer(ctx); err != nil {
|
||||
@@ -114,7 +115,7 @@ func (s *DockerService) hostConfig() *container.HostConfig {
|
||||
func (s *DockerService) startNewContainer(ctx context.Context) error {
|
||||
_, err := s.Client.ContainerCreate(ctx, s.containerConfig(), s.hostConfig(), nil, nil, s.Name)
|
||||
if err != nil {
|
||||
if !client.IsErrNotFound(err) {
|
||||
if !errdefs.IsNotFound(err) {
|
||||
return fmt.Errorf("create container: %w", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"io"
|
||||
|
||||
"github.com/distribution/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/volume"
|
||||
@@ -94,8 +93,8 @@ func (c *Client) CreateContainer(
|
||||
}
|
||||
|
||||
// InspectContainer returns the container information for the given container ID.
|
||||
func (c *Client) InspectContainer(ctx context.Context, id string) (types.ContainerJSON, error) {
|
||||
var resp types.ContainerJSON
|
||||
func (c *Client) InspectContainer(ctx context.Context, id string) (container.InspectResponse, error) {
|
||||
var resp container.InspectResponse
|
||||
|
||||
grpcResp, err := c.GRPCClient.InspectContainer(ctx, &pb.InspectContainerRequest{Id: id})
|
||||
if err != nil {
|
||||
@@ -151,7 +150,7 @@ func (c *Client) StopContainer(ctx context.Context, id string, opts container.St
|
||||
|
||||
type MachineContainers struct {
|
||||
Metadata *pb.Metadata
|
||||
Containers []types.ContainerJSON
|
||||
Containers []container.InspectResponse
|
||||
}
|
||||
|
||||
func (c *Client) ListContainers(ctx context.Context, opts container.ListOptions) ([]MachineContainers, error) {
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
"net/netip"
|
||||
"strconv"
|
||||
|
||||
"github.com/containerd/errdefs"
|
||||
dockercontainer "github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
dnetwork "github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/client"
|
||||
"github.com/docker/docker/libnetwork/iptables"
|
||||
"github.com/psviderski/uncloud/internal/machine/dns"
|
||||
"github.com/psviderski/uncloud/internal/machine/firewall"
|
||||
@@ -27,7 +27,7 @@ func (c *Controller) EnsureUncloudNetwork(ctx context.Context, subnet netip.Pref
|
||||
needsCreation := false
|
||||
nw, err := c.client.NetworkInspect(ctx, NetworkName, dnetwork.InspectOptions{})
|
||||
if err != nil {
|
||||
if !client.IsErrNotFound(err) {
|
||||
if !errdefs.IsNotFound(err) {
|
||||
return fmt.Errorf("inspect Docker network '%s': %w", NetworkName, err)
|
||||
}
|
||||
needsCreation = true
|
||||
@@ -187,7 +187,7 @@ func (c *Controller) Cleanup() error {
|
||||
|
||||
for _, ctr := range containers {
|
||||
err = c.client.ContainerStop(ctx, ctr.ID, dockercontainer.StopOptions{})
|
||||
if err != nil && !client.IsErrNotFound(err) {
|
||||
if err != nil && !errdefs.IsNotFound(err) {
|
||||
errs = append(errs, fmt.Errorf("stop container '%s': %w", ctr.ID, err))
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ func (c *Controller) Cleanup() error {
|
||||
})
|
||||
if err == nil {
|
||||
removed++
|
||||
} else if !client.IsErrNotFound(err) {
|
||||
} else if !errdefs.IsNotFound(err) {
|
||||
errs = append(errs, fmt.Errorf("remove container '%s': %w", ctr.ID, err))
|
||||
}
|
||||
}
|
||||
@@ -223,10 +223,10 @@ func (c *Controller) Cleanup() error {
|
||||
|
||||
if err = c.client.NetworkRemove(ctx, NetworkName); err == nil {
|
||||
slog.Info("Docker network removed.", "name", NetworkName)
|
||||
} else if !client.IsErrNotFound(err) {
|
||||
} else if !errdefs.IsNotFound(err) {
|
||||
errs = append(errs, fmt.Errorf("remove Docker network '%s': %w", NetworkName, err))
|
||||
}
|
||||
} else if !client.IsErrNotFound(err) {
|
||||
} else if !errdefs.IsNotFound(err) {
|
||||
errs = append(errs, fmt.Errorf("inspect Docker network '%s': %w", NetworkName, err))
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/distribution/reference"
|
||||
dockercommand "github.com/docker/cli/cli/command"
|
||||
dockerconfig "github.com/docker/cli/cli/config"
|
||||
"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"
|
||||
@@ -114,7 +114,7 @@ func (s *Server) CreateContainer(ctx context.Context, req *pb.CreateContainerReq
|
||||
|
||||
resp, err := s.client.ContainerCreate(ctx, &config, &hostConfig, &networkConfig, &platform, req.Name)
|
||||
if err != nil {
|
||||
if client.IsErrNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
}
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
@@ -132,7 +132,7 @@ func (s *Server) CreateContainer(ctx context.Context, req *pb.CreateContainerReq
|
||||
func (s *Server) InspectContainer(ctx context.Context, req *pb.InspectContainerRequest) (*pb.InspectContainerResponse, error) {
|
||||
resp, err := s.client.ContainerInspect(ctx, req.Id)
|
||||
if err != nil {
|
||||
if client.IsErrNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
}
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
@@ -165,7 +165,7 @@ func (s *Server) StartContainer(ctx context.Context, req *pb.StartContainerReque
|
||||
}
|
||||
|
||||
if err := s.client.ContainerStart(ctx, req.Id, opts); err != nil {
|
||||
if client.IsErrNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
}
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
@@ -184,7 +184,7 @@ func (s *Server) StopContainer(ctx context.Context, req *pb.StopContainerRequest
|
||||
}
|
||||
|
||||
if err := s.client.ContainerStop(ctx, req.Id, opts); err != nil {
|
||||
if client.IsErrNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
}
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
@@ -219,11 +219,11 @@ func (s *Server) ListContainers(ctx context.Context, req *pb.ListContainersReque
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
containers := make([]types.ContainerJSON, 0, len(containerSummaries))
|
||||
containers := make([]container.InspectResponse, 0, len(containerSummaries))
|
||||
for _, cs := range containerSummaries {
|
||||
c, err := s.client.ContainerInspect(ctx, cs.ID)
|
||||
if err != nil {
|
||||
if client.IsErrNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
// The listed container may have been removed while we were inspecting other containers.
|
||||
continue
|
||||
}
|
||||
@@ -256,7 +256,7 @@ func (s *Server) RemoveContainer(ctx context.Context, req *pb.RemoveContainerReq
|
||||
}
|
||||
|
||||
if err := s.client.ContainerRemove(ctx, req.Id, opts); err != nil {
|
||||
if client.IsErrNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
}
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
@@ -323,9 +323,9 @@ func (s *Server) PullImage(req *pb.PullImageRequest, stream grpc.ServerStreaming
|
||||
|
||||
// InspectImage returns the image information for the given image ID.
|
||||
func (s *Server) InspectImage(ctx context.Context, req *pb.InspectImageRequest) (*pb.InspectImageResponse, error) {
|
||||
resp, _, err := s.client.ImageInspectWithRaw(ctx, req.Id)
|
||||
resp, err := s.client.ImageInspect(ctx, req.Id)
|
||||
if err != nil {
|
||||
if client.IsErrNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
}
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
@@ -498,7 +498,7 @@ func (s *Server) ListVolumes(ctx context.Context, req *pb.ListVolumesRequest) (*
|
||||
// RemoveVolume removes a volume with the given ID.
|
||||
func (s *Server) RemoveVolume(ctx context.Context, req *pb.RemoveVolumeRequest) (*emptypb.Empty, error) {
|
||||
if err := s.client.VolumeRemove(ctx, req.Id, req.Force); err != nil {
|
||||
if client.IsErrNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
}
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
@@ -644,7 +644,7 @@ func (s *Server) CreateServiceContainer(
|
||||
|
||||
resp, err := s.client.ContainerCreate(ctx, config, hostConfig, networkConfig, nil, containerName)
|
||||
if err != nil {
|
||||
if client.IsErrNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
}
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
@@ -751,31 +751,31 @@ func (s *Server) injectConfigs(ctx context.Context, containerID string, configs
|
||||
}
|
||||
|
||||
// Process each config mount
|
||||
for _, mount := range mounts {
|
||||
config, exists := configMap[mount.ConfigName]
|
||||
for _, m := range mounts {
|
||||
config, exists := configMap[m.ConfigName]
|
||||
if !exists {
|
||||
return fmt.Errorf("config mount references a config that doesn't exist: '%s'", mount.ConfigName)
|
||||
return fmt.Errorf("config mount references a config that doesn't exist: '%s'", m.ConfigName)
|
||||
}
|
||||
|
||||
// Determine target path in container
|
||||
targetPath := mount.ContainerPath
|
||||
targetPath := m.ContainerPath
|
||||
if targetPath == "" {
|
||||
// This is the default from the Compose spec
|
||||
targetPath = filepath.Join("/", mount.ConfigName)
|
||||
targetPath = filepath.Join("/", m.ConfigName)
|
||||
}
|
||||
|
||||
// Determine file mode
|
||||
fileMode := os.FileMode(0o444) // Default permissions
|
||||
if mount.Mode != nil {
|
||||
fileMode = *mount.Mode
|
||||
if m.Mode != nil {
|
||||
fileMode = *m.Mode
|
||||
}
|
||||
|
||||
uid, err := mount.GetNumericUid()
|
||||
uid, err := m.GetNumericUid()
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid Uid: %w", err)
|
||||
}
|
||||
|
||||
gid, err := mount.GetNumericGid()
|
||||
gid, err := m.GetNumericGid()
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid Gid: %w", err)
|
||||
}
|
||||
@@ -880,7 +880,7 @@ func (s *Server) verifyDockerVolumesExist(ctx context.Context, mounts []mount.Mo
|
||||
|
||||
// TODO: non-local volume drivers should likely be handled differently (needs proper investigation).
|
||||
if _, err := s.client.VolumeInspect(ctx, m.Source); err != nil {
|
||||
if client.IsErrNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return status.Errorf(codes.NotFound, "volume '%s' not found", m.Source)
|
||||
}
|
||||
return status.Errorf(codes.Internal, "inspect volume '%s': %v", m.Source, err.Error())
|
||||
@@ -900,7 +900,7 @@ func (s *Server) InspectServiceContainer(
|
||||
) (*pb.ServiceContainer, error) {
|
||||
serviceCtr, err := s.service.InspectServiceContainer(ctx, req.Id)
|
||||
if err != nil {
|
||||
if client.IsErrNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
}
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
@@ -990,7 +990,7 @@ func (s *Server) RemoveServiceContainer(ctx context.Context, req *pb.RemoveConta
|
||||
if !fullDockerIDRegex.MatchString(req.Id) {
|
||||
ctr, err := s.client.ContainerInspect(ctx, req.Id)
|
||||
if err != nil {
|
||||
if client.IsErrNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
}
|
||||
return nil, status.Error(codes.Internal, err.Error())
|
||||
|
||||
@@ -49,7 +49,7 @@ func (s *Service) InspectServiceContainer(ctx context.Context, nameOrID string)
|
||||
return serviceCtr, fmt.Errorf("container '%s' is not managed by Uncloud", nameOrID)
|
||||
}
|
||||
|
||||
serviceCtr.Container = api.Container{ContainerJSON: ctr}
|
||||
serviceCtr.Container = api.Container{InspectResponse: ctr}
|
||||
|
||||
// Retrieve ServiceSpec from the machine database.
|
||||
var specBytes []byte
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/cenkalti/backoff/v4"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
dockerclient "github.com/docker/docker/client"
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/psviderski/uncloud/internal/machine"
|
||||
"github.com/psviderski/uncloud/internal/machine/api/pb"
|
||||
@@ -200,7 +200,7 @@ func (p *Provisioner) InspectCluster(ctx context.Context, name string) (Cluster,
|
||||
// Docker network name is the same as the cluster name.
|
||||
net, err := p.dockerCli.NetworkInspect(ctx, name, network.InspectOptions{})
|
||||
if err != nil {
|
||||
if dockerclient.IsErrNotFound(err) {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return c, ErrNotFound
|
||||
}
|
||||
return c, fmt.Errorf("inspect Docker network '%s': %w", name, err)
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/cenkalti/backoff/v4"
|
||||
"github.com/containerd/errdefs"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/image"
|
||||
dockerclient "github.com/docker/docker/client"
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/psviderski/uncloud/internal/secret"
|
||||
"github.com/psviderski/uncloud/pkg/client"
|
||||
@@ -137,7 +137,7 @@ func (p *Provisioner) createContainerWithImagePull(
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
if !dockerclient.IsErrNotFound(err) {
|
||||
if !errdefs.IsNotFound(err) {
|
||||
return resp, fmt.Errorf("create Docker container: %w", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user