diff --git a/cli/command/network/client_test.go b/cli/command/network/client_test.go index 54953fe2ca..aa13a3d09e 100644 --- a/cli/command/network/client_test.go +++ b/cli/command/network/client_test.go @@ -3,7 +3,6 @@ package network import ( "context" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/network" "github.com/docker/docker/client" @@ -11,16 +10,16 @@ import ( type fakeClient struct { client.Client - networkCreateFunc func(ctx context.Context, name string, options types.NetworkCreate) (network.CreateResponse, error) + networkCreateFunc func(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error) networkConnectFunc func(ctx context.Context, networkID, container string, config *network.EndpointSettings) error networkDisconnectFunc func(ctx context.Context, networkID, container string, force bool) error networkRemoveFunc func(ctx context.Context, networkID string) error networkListFunc func(ctx context.Context, options network.ListOptions) ([]network.Summary, error) - networkPruneFunc func(ctx context.Context, pruneFilters filters.Args) (types.NetworksPruneReport, error) + networkPruneFunc func(ctx context.Context, pruneFilters filters.Args) (network.PruneReport, error) networkInspectFunc func(ctx context.Context, networkID string, options network.InspectOptions) (network.Inspect, []byte, error) } -func (c *fakeClient) NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (network.CreateResponse, error) { +func (c *fakeClient) NetworkCreate(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error) { if c.networkCreateFunc != nil { return c.networkCreateFunc(ctx, name, options) } @@ -62,9 +61,9 @@ func (c *fakeClient) NetworkInspectWithRaw(ctx context.Context, networkID string return network.Inspect{}, nil, nil } -func (c *fakeClient) NetworksPrune(ctx context.Context, pruneFilter filters.Args) (types.NetworksPruneReport, error) { +func (c *fakeClient) NetworksPrune(ctx context.Context, pruneFilter filters.Args) (network.PruneReport, error) { if c.networkPruneFunc != nil { return c.networkPruneFunc(ctx, pruneFilter) } - return types.NetworksPruneReport{}, nil + return network.PruneReport{}, nil } diff --git a/cli/command/network/create.go b/cli/command/network/create.go index 9ff2419144..45aead0229 100644 --- a/cli/command/network/create.go +++ b/cli/command/network/create.go @@ -10,7 +10,6 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command/completion" "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/network" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -104,7 +103,7 @@ func runCreate(ctx context.Context, dockerCli command.Cli, options createOptions Network: options.configFrom, } } - resp, err := client.NetworkCreate(ctx, options.name, types.NetworkCreate{ + resp, err := client.NetworkCreate(ctx, options.name, network.CreateOptions{ Driver: options.driver, Options: options.driverOpts.GetAll(), IPAM: &network.IPAM{ diff --git a/cli/command/network/create_test.go b/cli/command/network/create_test.go index 226c118c7d..30707c2792 100644 --- a/cli/command/network/create_test.go +++ b/cli/command/network/create_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/network" "github.com/pkg/errors" "gotest.tools/v3/assert" @@ -18,7 +17,7 @@ func TestNetworkCreateErrors(t *testing.T) { testCases := []struct { args []string flags map[string]string - networkCreateFunc func(ctx context.Context, name string, options types.NetworkCreate) (network.CreateResponse, error) + networkCreateFunc func(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error) expectedError string }{ { @@ -26,7 +25,7 @@ func TestNetworkCreateErrors(t *testing.T) { }, { args: []string{"toto"}, - networkCreateFunc: func(ctx context.Context, name string, createBody types.NetworkCreate) (network.CreateResponse, error) { + networkCreateFunc: func(ctx context.Context, name string, createBody network.CreateOptions) (network.CreateResponse, error) { return network.CreateResponse{}, errors.Errorf("error creating network") }, expectedError: "error creating network", @@ -153,9 +152,9 @@ func TestNetworkCreateWithFlags(t *testing.T) { }, } cli := test.NewFakeCli(&fakeClient{ - networkCreateFunc: func(ctx context.Context, name string, createBody types.NetworkCreate) (network.CreateResponse, error) { - assert.Check(t, is.Equal(expectedDriver, createBody.Driver), "not expected driver error") - assert.Check(t, is.DeepEqual(expectedOpts, createBody.IPAM.Config), "not expected driver error") + networkCreateFunc: func(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error) { + assert.Check(t, is.Equal(expectedDriver, options.Driver), "not expected driver error") + assert.Check(t, is.DeepEqual(expectedOpts, options.IPAM.Config), "not expected driver error") return network.CreateResponse{ ID: name, }, nil @@ -212,7 +211,7 @@ func TestNetworkCreateIPv6(t *testing.T) { tc := tc t.Run(tc.doc, func(t *testing.T) { cli := test.NewFakeCli(&fakeClient{ - networkCreateFunc: func(ctx context.Context, name string, createBody types.NetworkCreate) (network.CreateResponse, error) { + networkCreateFunc: func(ctx context.Context, name string, createBody network.CreateOptions) (network.CreateResponse, error) { assert.Check(t, is.DeepEqual(tc.expected, createBody.EnableIPv6)) return network.CreateResponse{ID: name}, nil }, diff --git a/cli/command/network/prune_test.go b/cli/command/network/prune_test.go index 647899560d..b59dfff814 100644 --- a/cli/command/network/prune_test.go +++ b/cli/command/network/prune_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/api/types/network" "github.com/pkg/errors" ) @@ -15,8 +15,8 @@ func TestNetworkPrunePromptTermination(t *testing.T) { t.Cleanup(cancel) cli := test.NewFakeCli(&fakeClient{ - networkPruneFunc: func(ctx context.Context, pruneFilters filters.Args) (types.NetworksPruneReport, error) { - return types.NetworksPruneReport{}, errors.New("fakeClient networkPruneFunc should not be called") + networkPruneFunc: func(ctx context.Context, pruneFilters filters.Args) (network.PruneReport, error) { + return network.PruneReport{}, errors.New("fakeClient networkPruneFunc should not be called") }, }) cmd := NewPruneCommand(cli) diff --git a/cli/command/stack/swarm/deploy_composefile.go b/cli/command/stack/swarm/deploy_composefile.go index 841e8dd567..4e71c01922 100644 --- a/cli/command/stack/swarm/deploy_composefile.go +++ b/cli/command/stack/swarm/deploy_composefile.go @@ -157,7 +157,7 @@ func createConfigs(ctx context.Context, dockerCli command.Cli, configs []swarm.C return nil } -func createNetworks(ctx context.Context, dockerCli command.Cli, namespace convert.Namespace, networks map[string]types.NetworkCreate) error { +func createNetworks(ctx context.Context, dockerCli command.Cli, namespace convert.Namespace, networks map[string]network.CreateOptions) error { client := dockerCli.Client() existingNetworks, err := getStackNetworks(ctx, client, namespace.Name()) diff --git a/cli/command/system/client_test.go b/cli/command/system/client_test.go index 01dc4b3d25..2046b65736 100644 --- a/cli/command/system/client_test.go +++ b/cli/command/system/client_test.go @@ -6,6 +6,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/events" "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/api/types/network" "github.com/docker/docker/client" ) @@ -16,7 +17,7 @@ type fakeClient struct { serverVersion func(ctx context.Context) (types.Version, error) eventsFn func(context.Context, types.EventsOptions) (<-chan events.Message, <-chan error) containerPruneFunc func(ctx context.Context, pruneFilters filters.Args) (types.ContainersPruneReport, error) - networkPruneFunc func(ctx context.Context, pruneFilter filters.Args) (types.NetworksPruneReport, error) + networkPruneFunc func(ctx context.Context, pruneFilter filters.Args) (network.PruneReport, error) } func (cli *fakeClient) ServerVersion(ctx context.Context) (types.Version, error) { @@ -38,9 +39,9 @@ func (cli *fakeClient) ContainersPrune(ctx context.Context, pruneFilters filters return types.ContainersPruneReport{}, nil } -func (cli *fakeClient) NetworksPrune(ctx context.Context, pruneFilter filters.Args) (types.NetworksPruneReport, error) { +func (cli *fakeClient) NetworksPrune(ctx context.Context, pruneFilter filters.Args) (network.PruneReport, error) { if cli.networkPruneFunc != nil { return cli.networkPruneFunc(ctx, pruneFilter) } - return types.NetworksPruneReport{}, nil + return network.PruneReport{}, nil } diff --git a/cli/command/system/prune_test.go b/cli/command/system/prune_test.go index c2d5f7eeb1..6c4716fe62 100644 --- a/cli/command/system/prune_test.go +++ b/cli/command/system/prune_test.go @@ -8,6 +8,7 @@ import ( "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/api/types/network" "github.com/pkg/errors" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -62,8 +63,8 @@ func TestSystemPrunePromptTermination(t *testing.T) { containerPruneFunc: func(ctx context.Context, pruneFilters filters.Args) (types.ContainersPruneReport, error) { return types.ContainersPruneReport{}, errors.New("fakeClient containerPruneFunc should not be called") }, - networkPruneFunc: func(ctx context.Context, pruneFilters filters.Args) (types.NetworksPruneReport, error) { - return types.NetworksPruneReport{}, errors.New("fakeClient networkPruneFunc should not be called") + networkPruneFunc: func(ctx context.Context, pruneFilters filters.Args) (network.PruneReport, error) { + return network.PruneReport{}, errors.New("fakeClient networkPruneFunc should not be called") }, }) diff --git a/cli/compose/convert/compose.go b/cli/compose/convert/compose.go index 98cd92989b..a04f22e80c 100644 --- a/cli/compose/convert/compose.go +++ b/cli/compose/convert/compose.go @@ -5,8 +5,7 @@ import ( "strings" composetypes "github.com/docker/cli/cli/compose/types" - "github.com/docker/docker/api/types" - networktypes "github.com/docker/docker/api/types/network" + "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/swarm" ) @@ -52,45 +51,45 @@ func AddStackLabel(namespace Namespace, labels map[string]string) map[string]str type networkMap map[string]composetypes.NetworkConfig // Networks from the compose-file type to the engine API type -func Networks(namespace Namespace, networks networkMap, servicesNetworks map[string]struct{}) (map[string]types.NetworkCreate, []string) { +func Networks(namespace Namespace, networks networkMap, servicesNetworks map[string]struct{}) (map[string]network.CreateOptions, []string) { if networks == nil { networks = make(map[string]composetypes.NetworkConfig) } externalNetworks := []string{} - result := make(map[string]types.NetworkCreate) + result := make(map[string]network.CreateOptions) for internalName := range servicesNetworks { - network := networks[internalName] - if network.External.External { - externalNetworks = append(externalNetworks, network.Name) + nw := networks[internalName] + if nw.External.External { + externalNetworks = append(externalNetworks, nw.Name) continue } - createOpts := types.NetworkCreate{ - Labels: AddStackLabel(namespace, network.Labels), - Driver: network.Driver, - Options: network.DriverOpts, - Internal: network.Internal, - Attachable: network.Attachable, + createOpts := network.CreateOptions{ + Labels: AddStackLabel(namespace, nw.Labels), + Driver: nw.Driver, + Options: nw.DriverOpts, + Internal: nw.Internal, + Attachable: nw.Attachable, } - if network.Ipam.Driver != "" || len(network.Ipam.Config) > 0 { - createOpts.IPAM = &networktypes.IPAM{} + if nw.Ipam.Driver != "" || len(nw.Ipam.Config) > 0 { + createOpts.IPAM = &network.IPAM{} } - if network.Ipam.Driver != "" { - createOpts.IPAM.Driver = network.Ipam.Driver + if nw.Ipam.Driver != "" { + createOpts.IPAM.Driver = nw.Ipam.Driver } - for _, ipamConfig := range network.Ipam.Config { - config := networktypes.IPAMConfig{ + for _, ipamConfig := range nw.Ipam.Config { + config := network.IPAMConfig{ Subnet: ipamConfig.Subnet, } createOpts.IPAM.Config = append(createOpts.IPAM.Config, config) } networkName := namespace.Scope(internalName) - if network.Name != "" { - networkName = network.Name + if nw.Name != "" { + networkName = nw.Name } result[networkName] = createOpts } diff --git a/cli/compose/convert/compose_test.go b/cli/compose/convert/compose_test.go index 900f1cc2d4..c29596e423 100644 --- a/cli/compose/convert/compose_test.go +++ b/cli/compose/convert/compose_test.go @@ -4,7 +4,6 @@ import ( "testing" composetypes "github.com/docker/cli/cli/compose/types" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/network" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" @@ -77,7 +76,7 @@ func TestNetworks(t *testing.T) { Name: "othername", }, } - expected := map[string]types.NetworkCreate{ + expected := map[string]network.CreateOptions{ "foo_default": { Labels: map[string]string{ LabelNamespace: "foo", diff --git a/vendor.mod b/vendor.mod index 08c1239272..ba47d3605e 100644 --- a/vendor.mod +++ b/vendor.mod @@ -12,7 +12,7 @@ require ( github.com/creack/pty v1.1.21 github.com/distribution/reference v0.5.0 github.com/docker/distribution v2.8.3+incompatible - github.com/docker/docker v26.1.1-0.20240606182029-00f18ef7a455+incompatible // master (v27.0.0-dev) + github.com/docker/docker v26.1.1-0.20240607121412-59996a493cfc+incompatible // master (v27.0.0-dev) github.com/docker/docker-credential-helpers v0.8.2 github.com/docker/go-connections v0.5.0 github.com/docker/go-units v0.5.0 diff --git a/vendor.sum b/vendor.sum index a1c1247034..a6b236e2ce 100644 --- a/vendor.sum +++ b/vendor.sum @@ -59,8 +59,8 @@ github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5 github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v26.1.1-0.20240606182029-00f18ef7a455+incompatible h1:6OR7f7LuvJU27W400ctN0mxeAGDnPc0Fg2IGQhltKb0= -github.com/docker/docker v26.1.1-0.20240606182029-00f18ef7a455+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v26.1.1-0.20240607121412-59996a493cfc+incompatible h1:MQR7fZxS7agfjACehtep/M6Bvz7/pFvbOcFvtTmvKlg= +github.com/docker/docker v26.1.1-0.20240607121412-59996a493cfc+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.8.2 h1:bX3YxiGzFP5sOXWc3bTPEXdEaZSeVMrFgOr3T+zrFAo= github.com/docker/docker-credential-helpers v0.8.2/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= diff --git a/vendor/github.com/docker/docker/api/swagger.yaml b/vendor/github.com/docker/docker/api/swagger.yaml index e4b9859b8d..ba573e7056 100644 --- a/vendor/github.com/docker/docker/api/swagger.yaml +++ b/vendor/github.com/docker/docker/api/swagger.yaml @@ -4741,6 +4741,12 @@ definitions: properties: NetworkMode: type: "string" + Annotations: + description: "Arbitrary key-value metadata attached to container" + type: "object" + x-nullable: true + additionalProperties: + type: "string" NetworkSettings: description: "A summary of the container's network settings" type: "object" @@ -6390,6 +6396,8 @@ paths: SizeRootFs: 0 HostConfig: NetworkMode: "default" + Annotations: + io.kubernetes.docker.type: "container" NetworkSettings: Networks: bridge: @@ -6425,6 +6433,9 @@ paths: SizeRootFs: 0 HostConfig: NetworkMode: "default" + Annotations: + io.kubernetes.docker.type: "container" + io.kubernetes.sandbox.id: "3befe639bed0fd6afdd65fd1fa84506756f59360ec4adc270b0fdac9be22b4d3" NetworkSettings: Networks: bridge: @@ -6453,6 +6464,9 @@ paths: SizeRootFs: 0 HostConfig: NetworkMode: "default" + Annotations: + io.kubernetes.image.id: "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82" + io.kubernetes.image.name: "ubuntu:latest" NetworkSettings: Networks: bridge: @@ -6481,6 +6495,8 @@ paths: SizeRootFs: 0 HostConfig: NetworkMode: "default" + Annotations: + io.kubernetes.config.source: "api" NetworkSettings: Networks: bridge: @@ -10197,11 +10213,6 @@ paths: description: "The network's name." type: "string" example: "my_network" - CheckDuplicate: - description: | - Deprecated: CheckDuplicate is now always enabled. - type: "boolean" - example: true Driver: description: "Name of the network driver plugin to use." type: "string" diff --git a/vendor/github.com/docker/docker/api/types/network/network.go b/vendor/github.com/docker/docker/api/types/network/network.go index c86fc903af..c8db97a7e6 100644 --- a/vendor/github.com/docker/docker/api/types/network/network.go +++ b/vendor/github.com/docker/docker/api/types/network/network.go @@ -19,6 +19,31 @@ const ( NetworkNat = "nat" ) +// CreateRequest is the request message sent to the server for network create call. +type CreateRequest struct { + CreateOptions + Name string // Name is the requested name of the network. + + // Deprecated: CheckDuplicate is deprecated since API v1.44, but it defaults to true when sent by the client + // package to older daemons. + CheckDuplicate *bool `json:",omitempty"` +} + +// CreateOptions holds options to create a network. +type CreateOptions struct { + Driver string // Driver is the driver-name used to create the network (e.g. `bridge`, `overlay`) + Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level). + EnableIPv6 *bool `json:",omitempty"` // EnableIPv6 represents whether to enable IPv6. + IPAM *IPAM // IPAM is the network's IP Address Management. + Internal bool // Internal represents if the network is used internal only. + Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode. + Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster. + ConfigOnly bool // ConfigOnly creates a config-only network. Config-only networks are place-holder networks for network configurations to be used by other networks. ConfigOnly networks cannot be used directly to run containers or services. + ConfigFrom *ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network. The specified network must be a config-only network; see [CreateOptions.ConfigOnly]. + Options map[string]string // Options specifies the network-specific options to use for when creating the network. + Labels map[string]string // Labels holds metadata specific to the network being created. +} + // ListOptions holds parameters to filter the list of networks with. type ListOptions struct { Filters filters.Args @@ -133,3 +158,9 @@ var acceptedFilters = map[string]bool{ func ValidateFilters(filter filters.Args) error { return filter.Validate(acceptedFilters) } + +// PruneReport contains the response for Engine API: +// POST "/networks/prune" +type PruneReport struct { + NetworksDeleted []string +} diff --git a/vendor/github.com/docker/docker/api/types/types.go b/vendor/github.com/docker/docker/api/types/types.go index 5d6b40b669..54d986385b 100644 --- a/vendor/github.com/docker/docker/api/types/types.go +++ b/vendor/github.com/docker/docker/api/types/types.go @@ -155,7 +155,8 @@ type Container struct { State string Status string HostConfig struct { - NetworkMode string `json:",omitempty"` + NetworkMode string `json:",omitempty"` + Annotations map[string]string `json:",omitempty"` } NetworkSettings *SummaryNetworkSettings Mounts []MountPoint @@ -423,30 +424,6 @@ type MountPoint struct { Propagation mount.Propagation } -// NetworkCreate is the expected body of the "create network" http request message -type NetworkCreate struct { - // Deprecated: CheckDuplicate is deprecated since API v1.44, but it defaults to true when sent by the client - // package to older daemons. - CheckDuplicate bool `json:",omitempty"` - Driver string // Driver is the driver-name used to create the network (e.g. `bridge`, `overlay`) - Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level). - EnableIPv6 *bool `json:",omitempty"` // EnableIPv6 represents whether to enable IPv6. - IPAM *network.IPAM // IPAM is the network's IP Address Management. - Internal bool // Internal represents if the network is used internal only. - Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode. - Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster. - ConfigOnly bool // ConfigOnly creates a config-only network. Config-only networks are place-holder networks for network configurations to be used by other networks. ConfigOnly networks cannot be used directly to run containers or services. - ConfigFrom *network.ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network. The specified network must be a config-only network; see [NetworkCreate.ConfigOnly]. - Options map[string]string // Options specifies the network-specific options to use for when creating the network. - Labels map[string]string // Labels holds metadata specific to the network being created. -} - -// NetworkCreateRequest is the request message sent to the server for network create call. -type NetworkCreateRequest struct { - NetworkCreate - Name string // Name is the requested name of the network. -} - // DiskUsageObject represents an object type used for disk usage query filtering. type DiskUsageObject string @@ -507,12 +484,6 @@ type BuildCachePruneReport struct { SpaceReclaimed uint64 } -// NetworksPruneReport contains the response for Engine API: -// POST "/networks/prune" -type NetworksPruneReport struct { - NetworksDeleted []string -} - // SecretCreateResponse contains the information returned to a client // on the creation of a new secret. type SecretCreateResponse struct { diff --git a/vendor/github.com/docker/docker/api/types/types_deprecated.go b/vendor/github.com/docker/docker/api/types/types_deprecated.go index 3648ddcf60..c0e146ca7d 100644 --- a/vendor/github.com/docker/docker/api/types/types_deprecated.go +++ b/vendor/github.com/docker/docker/api/types/types_deprecated.go @@ -4,6 +4,16 @@ import ( "github.com/docker/docker/api/types/network" ) +// NetworkCreateRequest is the request message sent to the server for network create call. +// +// Deprecated: use [network.CreateRequest]. +type NetworkCreateRequest = network.CreateRequest + +// NetworkCreate is the expected body of the "create network" http request message +// +// Deprecated: use [network.CreateOptions]. +type NetworkCreate = network.CreateOptions + // NetworkListOptions holds parameters to filter the list of networks with. // // Deprecated: use [network.ListOptions]. @@ -38,3 +48,9 @@ type EndpointResource = network.EndpointResource // // Deprecated: use [network.Inspect] or [network.Summary] (for list operations). type NetworkResource = network.Inspect + +// NetworksPruneReport contains the response for Engine API: +// POST "/networks/prune" +// +// Deprecated: use [network.PruneReport]. +type NetworksPruneReport = network.PruneReport diff --git a/vendor/github.com/docker/docker/client/interface.go b/vendor/github.com/docker/docker/client/interface.go index 01ea36b7d9..29fd76ab81 100644 --- a/vendor/github.com/docker/docker/client/interface.go +++ b/vendor/github.com/docker/docker/client/interface.go @@ -108,13 +108,13 @@ type ImageAPIClient interface { // NetworkAPIClient defines API client methods for the networks type NetworkAPIClient interface { NetworkConnect(ctx context.Context, network, container string, config *network.EndpointSettings) error - NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (network.CreateResponse, error) + NetworkCreate(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error) NetworkDisconnect(ctx context.Context, network, container string, force bool) error NetworkInspect(ctx context.Context, network string, options network.InspectOptions) (network.Inspect, error) NetworkInspectWithRaw(ctx context.Context, network string, options network.InspectOptions) (network.Inspect, []byte, error) NetworkList(ctx context.Context, options network.ListOptions) ([]network.Summary, error) NetworkRemove(ctx context.Context, network string) error - NetworksPrune(ctx context.Context, pruneFilter filters.Args) (types.NetworksPruneReport, error) + NetworksPrune(ctx context.Context, pruneFilter filters.Args) (network.PruneReport, error) } // NodeAPIClient defines API client methods for the nodes diff --git a/vendor/github.com/docker/docker/client/network_create.go b/vendor/github.com/docker/docker/client/network_create.go index 66f7fe8289..850e31cc97 100644 --- a/vendor/github.com/docker/docker/client/network_create.go +++ b/vendor/github.com/docker/docker/client/network_create.go @@ -4,13 +4,12 @@ import ( "context" "encoding/json" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/versions" ) // NetworkCreate creates a new network in the docker host. -func (cli *Client) NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (network.CreateResponse, error) { +func (cli *Client) NetworkCreate(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error) { var response network.CreateResponse // Make sure we negotiated (if the client is configured to do so), @@ -22,12 +21,13 @@ func (cli *Client) NetworkCreate(ctx context.Context, name string, options types return response, err } - networkCreateRequest := types.NetworkCreateRequest{ - NetworkCreate: options, + networkCreateRequest := network.CreateRequest{ + CreateOptions: options, Name: name, } if versions.LessThan(cli.version, "1.44") { - networkCreateRequest.CheckDuplicate = true //nolint:staticcheck // ignore SA1019: CheckDuplicate is deprecated since API v1.44. + enabled := true + networkCreateRequest.CheckDuplicate = &enabled //nolint:staticcheck // ignore SA1019: CheckDuplicate is deprecated since API v1.44. } serverResp, err := cli.post(ctx, "/networks/create", nil, networkCreateRequest, nil) diff --git a/vendor/github.com/docker/docker/client/network_prune.go b/vendor/github.com/docker/docker/client/network_prune.go index 7b5f831ef7..708cc61a4b 100644 --- a/vendor/github.com/docker/docker/client/network_prune.go +++ b/vendor/github.com/docker/docker/client/network_prune.go @@ -5,13 +5,13 @@ import ( "encoding/json" "fmt" - "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" + "github.com/docker/docker/api/types/network" ) // NetworksPrune requests the daemon to delete unused networks -func (cli *Client) NetworksPrune(ctx context.Context, pruneFilters filters.Args) (types.NetworksPruneReport, error) { - var report types.NetworksPruneReport +func (cli *Client) NetworksPrune(ctx context.Context, pruneFilters filters.Args) (network.PruneReport, error) { + var report network.PruneReport if err := cli.NewVersionError(ctx, "1.25", "network prune"); err != nil { return report, err diff --git a/vendor/modules.txt b/vendor/modules.txt index 86c86a46b2..007ea92cc4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -56,7 +56,7 @@ github.com/docker/distribution/registry/client/transport github.com/docker/distribution/registry/storage/cache github.com/docker/distribution/registry/storage/cache/memory github.com/docker/distribution/uuid -# github.com/docker/docker v26.1.1-0.20240606182029-00f18ef7a455+incompatible +# github.com/docker/docker v26.1.1-0.20240607121412-59996a493cfc+incompatible ## explicit github.com/docker/docker/api github.com/docker/docker/api/types