mirror of https://github.com/docker/cli.git
Merge pull request #5100 from thaJeztah/bump_engine
vendor: github.com/docker/docker e622cea55698 (master / v27.0.0-dev)
This commit is contained in:
commit
1a8fa8b73e
|
@ -11,20 +11,20 @@ import (
|
|||
|
||||
type fakeClient struct {
|
||||
client.Client
|
||||
networkCreateFunc func(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
|
||||
networkCreateFunc func(ctx context.Context, name string, options types.NetworkCreate) (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 types.NetworkListOptions) ([]types.NetworkResource, error)
|
||||
networkPruneFunc func(ctx context.Context, pruneFilters filters.Args) (types.NetworksPruneReport, error)
|
||||
networkInspectFunc func(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, []byte, error)
|
||||
networkInspectFunc func(ctx context.Context, networkID string, options network.InspectOptions) (types.NetworkResource, []byte, error)
|
||||
}
|
||||
|
||||
func (c *fakeClient) NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error) {
|
||||
func (c *fakeClient) NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (network.CreateResponse, error) {
|
||||
if c.networkCreateFunc != nil {
|
||||
return c.networkCreateFunc(ctx, name, options)
|
||||
}
|
||||
return types.NetworkCreateResponse{}, nil
|
||||
return network.CreateResponse{}, nil
|
||||
}
|
||||
|
||||
func (c *fakeClient) NetworkConnect(ctx context.Context, networkID, container string, config *network.EndpointSettings) error {
|
||||
|
@ -55,7 +55,7 @@ func (c *fakeClient) NetworkRemove(ctx context.Context, networkID string) error
|
|||
return nil
|
||||
}
|
||||
|
||||
func (c *fakeClient) NetworkInspectWithRaw(ctx context.Context, networkID string, opts types.NetworkInspectOptions) (types.NetworkResource, []byte, error) {
|
||||
func (c *fakeClient) NetworkInspectWithRaw(ctx context.Context, networkID string, opts network.InspectOptions) (types.NetworkResource, []byte, error) {
|
||||
if c.networkInspectFunc != nil {
|
||||
return c.networkInspectFunc(ctx, networkID, opts)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ func TestNetworkCreateErrors(t *testing.T) {
|
|||
testCases := []struct {
|
||||
args []string
|
||||
flags map[string]string
|
||||
networkCreateFunc func(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
|
||||
networkCreateFunc func(ctx context.Context, name string, options types.NetworkCreate) (network.CreateResponse, error)
|
||||
expectedError string
|
||||
}{
|
||||
{
|
||||
|
@ -26,8 +26,8 @@ func TestNetworkCreateErrors(t *testing.T) {
|
|||
},
|
||||
{
|
||||
args: []string{"toto"},
|
||||
networkCreateFunc: func(ctx context.Context, name string, createBody types.NetworkCreate) (types.NetworkCreateResponse, error) {
|
||||
return types.NetworkCreateResponse{}, errors.Errorf("error creating network")
|
||||
networkCreateFunc: func(ctx context.Context, name string, createBody types.NetworkCreate) (network.CreateResponse, error) {
|
||||
return network.CreateResponse{}, errors.Errorf("error creating network")
|
||||
},
|
||||
expectedError: "error creating network",
|
||||
},
|
||||
|
@ -153,10 +153,10 @@ func TestNetworkCreateWithFlags(t *testing.T) {
|
|||
},
|
||||
}
|
||||
cli := test.NewFakeCli(&fakeClient{
|
||||
networkCreateFunc: func(ctx context.Context, name string, createBody types.NetworkCreate) (types.NetworkCreateResponse, error) {
|
||||
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")
|
||||
return types.NetworkCreateResponse{
|
||||
return network.CreateResponse{
|
||||
ID: name,
|
||||
}, nil
|
||||
},
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/docker/cli/cli/command/completion"
|
||||
"github.com/docker/cli/cli/command/inspect"
|
||||
flagsHelper "github.com/docker/cli/cli/flags"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -45,7 +45,7 @@ func runInspect(ctx context.Context, dockerCli command.Cli, opts inspectOptions)
|
|||
client := dockerCli.Client()
|
||||
|
||||
getNetFunc := func(name string) (any, []byte, error) {
|
||||
return client.NetworkInspectWithRaw(ctx, name, types.NetworkInspectOptions{Verbose: opts.verbose})
|
||||
return client.NetworkInspectWithRaw(ctx, name, network.InspectOptions{Verbose: opts.verbose})
|
||||
}
|
||||
|
||||
return inspect.Inspect(dockerCli.Out(), opts.names, opts.format, getNetFunc)
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"github.com/docker/cli/cli"
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/docker/cli/cli/command/completion"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
@ -46,7 +46,7 @@ func runRemove(ctx context.Context, dockerCli command.Cli, networks []string, op
|
|||
status := 0
|
||||
|
||||
for _, name := range networks {
|
||||
nw, _, err := client.NetworkInspectWithRaw(ctx, name, types.NetworkInspectOptions{})
|
||||
nw, _, err := client.NetworkInspectWithRaw(ctx, name, network.InspectOptions{})
|
||||
if err == nil && nw.Ingress {
|
||||
r, err := command.PromptForConfirmation(ctx, dockerCli.In(), dockerCli.Out(), ingressWarning)
|
||||
if err != nil {
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"github.com/docker/cli/internal/test"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/pkg/errors"
|
||||
"gotest.tools/v3/assert"
|
||||
|
@ -104,7 +105,7 @@ func TestNetworkRemovePromptTermination(t *testing.T) {
|
|||
networkRemoveFunc: func(ctx context.Context, networkID string) error {
|
||||
return errors.New("fakeClient networkRemoveFunc should not be called")
|
||||
},
|
||||
networkInspectFunc: func(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, []byte, error) {
|
||||
networkInspectFunc: func(ctx context.Context, networkID string, options network.InspectOptions) (types.NetworkResource, []byte, error) {
|
||||
return types.NetworkResource{
|
||||
ID: "existing-network",
|
||||
Name: "existing-network",
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
|
||||
"github.com/docker/cli/internal/test/builders"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/docker/docker/api/types/system"
|
||||
"github.com/docker/docker/client"
|
||||
|
@ -17,7 +18,7 @@ type fakeClient struct {
|
|||
serviceListFunc func(context.Context, types.ServiceListOptions) ([]swarm.Service, error)
|
||||
taskListFunc func(context.Context, types.TaskListOptions) ([]swarm.Task, error)
|
||||
infoFunc func(ctx context.Context) (system.Info, error)
|
||||
networkInspectFunc func(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, error)
|
||||
networkInspectFunc func(ctx context.Context, networkID string, options network.InspectOptions) (types.NetworkResource, error)
|
||||
nodeListFunc func(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error)
|
||||
}
|
||||
|
||||
|
@ -66,7 +67,7 @@ func (f *fakeClient) Info(ctx context.Context) (system.Info, error) {
|
|||
return f.infoFunc(ctx)
|
||||
}
|
||||
|
||||
func (f *fakeClient) NetworkInspect(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, error) {
|
||||
func (f *fakeClient) NetworkInspect(ctx context.Context, networkID string, options network.InspectOptions) (types.NetworkResource, error) {
|
||||
if f.networkInspectFunc != nil {
|
||||
return f.networkInspectFunc(ctx, networkID, options)
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/docker/cli/cli/command/formatter"
|
||||
flagsHelper "github.com/docker/cli/cli/flags"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -66,9 +67,9 @@ func runInspect(ctx context.Context, dockerCli command.Cli, opts inspectOptions)
|
|||
}
|
||||
|
||||
getNetwork := func(ref string) (any, []byte, error) {
|
||||
network, _, err := client.NetworkInspectWithRaw(ctx, ref, types.NetworkInspectOptions{Scope: "swarm"})
|
||||
nw, _, err := client.NetworkInspectWithRaw(ctx, ref, network.InspectOptions{Scope: "swarm"})
|
||||
if err == nil || !errdefs.IsNotFound(err) {
|
||||
return network, nil, err
|
||||
return nw, nil, err
|
||||
}
|
||||
return nil, nil, errors.Errorf("Error: no such network: %s", ref)
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ import (
|
|||
|
||||
"github.com/docker/cli/cli/command"
|
||||
"github.com/docker/cli/opts"
|
||||
"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/swarm"
|
||||
"github.com/docker/docker/client"
|
||||
gogotypes "github.com/gogo/protobuf/types"
|
||||
|
@ -376,7 +376,7 @@ func (c *credentialSpecOpt) Value() *swarm.CredentialSpec {
|
|||
}
|
||||
|
||||
func resolveNetworkID(ctx context.Context, apiClient client.NetworkAPIClient, networkIDOrName string) (string, error) {
|
||||
nw, err := apiClient.NetworkInspect(ctx, networkIDOrName, types.NetworkInspectOptions{Scope: "swarm"})
|
||||
nw, err := apiClient.NetworkInspect(ctx, networkIDOrName, network.InspectOptions{Scope: "swarm"})
|
||||
return nw.ID, err
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/docker/cli/opts"
|
||||
"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/swarm"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
|
@ -192,10 +193,10 @@ func TestToServiceNetwork(t *testing.T) {
|
|||
}
|
||||
|
||||
client := &fakeClient{
|
||||
networkInspectFunc: func(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, error) {
|
||||
for _, network := range nws {
|
||||
if network.ID == networkID || network.Name == networkID {
|
||||
return network, nil
|
||||
networkInspectFunc: func(ctx context.Context, networkID string, options network.InspectOptions) (types.NetworkResource, error) {
|
||||
for _, nw := range nws {
|
||||
if nw.ID == networkID || nw.Name == networkID {
|
||||
return nw, nil
|
||||
}
|
||||
}
|
||||
return types.NetworkResource{}, fmt.Errorf("network not found: %s", networkID)
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
mounttypes "github.com/docker/docker/api/types/mount"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/docker/docker/api/types/versions"
|
||||
"github.com/docker/docker/client"
|
||||
|
@ -1301,38 +1302,38 @@ func updateNetworks(ctx context.Context, apiClient client.NetworkAPIClient, flag
|
|||
toRemove := buildToRemoveSet(flags, flagNetworkRemove)
|
||||
idsToRemove := make(map[string]struct{})
|
||||
for networkIDOrName := range toRemove {
|
||||
network, err := apiClient.NetworkInspect(ctx, networkIDOrName, types.NetworkInspectOptions{Scope: "swarm"})
|
||||
nw, err := apiClient.NetworkInspect(ctx, networkIDOrName, network.InspectOptions{Scope: "swarm"})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
idsToRemove[network.ID] = struct{}{}
|
||||
idsToRemove[nw.ID] = struct{}{}
|
||||
}
|
||||
|
||||
existingNetworks := make(map[string]struct{})
|
||||
var newNetworks []swarm.NetworkAttachmentConfig //nolint:prealloc
|
||||
for _, network := range specNetworks {
|
||||
if _, exists := idsToRemove[network.Target]; exists {
|
||||
for _, nw := range specNetworks {
|
||||
if _, exists := idsToRemove[nw.Target]; exists {
|
||||
continue
|
||||
}
|
||||
|
||||
newNetworks = append(newNetworks, network)
|
||||
existingNetworks[network.Target] = struct{}{}
|
||||
newNetworks = append(newNetworks, nw)
|
||||
existingNetworks[nw.Target] = struct{}{}
|
||||
}
|
||||
|
||||
if flags.Changed(flagNetworkAdd) {
|
||||
values := flags.Lookup(flagNetworkAdd).Value.(*opts.NetworkOpt)
|
||||
networks := convertNetworks(*values)
|
||||
for _, network := range networks {
|
||||
nwID, err := resolveNetworkID(ctx, apiClient, network.Target)
|
||||
for _, nw := range networks {
|
||||
nwID, err := resolveNetworkID(ctx, apiClient, nw.Target)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, exists := existingNetworks[nwID]; exists {
|
||||
return errors.Errorf("service is already attached to network %s", network.Target)
|
||||
return errors.Errorf("service is already attached to network %s", nw.Target)
|
||||
}
|
||||
network.Target = nwID
|
||||
newNetworks = append(newNetworks, network)
|
||||
existingNetworks[network.Target] = struct{}{}
|
||||
nw.Target = nwID
|
||||
newNetworks = append(newNetworks, nw)
|
||||
existingNetworks[nw.Target] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
mounttypes "github.com/docker/docker/api/types/mount"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"github.com/docker/go-units"
|
||||
"gotest.tools/v3/assert"
|
||||
|
@ -853,10 +854,10 @@ func TestUpdateNetworks(t *testing.T) {
|
|||
}
|
||||
|
||||
client := &fakeClient{
|
||||
networkInspectFunc: func(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, error) {
|
||||
for _, network := range nws {
|
||||
if network.ID == networkID || network.Name == networkID {
|
||||
return network, nil
|
||||
networkInspectFunc: func(ctx context.Context, networkID string, options network.InspectOptions) (types.NetworkResource, error) {
|
||||
for _, nw := range nws {
|
||||
if nw.ID == networkID || nw.Name == networkID {
|
||||
return nw, nil
|
||||
}
|
||||
}
|
||||
return types.NetworkResource{}, fmt.Errorf("network not found: %s", networkID)
|
||||
|
|
|
@ -12,6 +12,7 @@ import (
|
|||
composetypes "github.com/docker/cli/cli/compose/types"
|
||||
"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/swarm"
|
||||
apiclient "github.com/docker/docker/client"
|
||||
"github.com/docker/docker/errdefs"
|
||||
|
@ -81,8 +82,8 @@ func getServicesDeclaredNetworks(serviceConfigs []composetypes.ServiceConfig) ma
|
|||
serviceNetworks["default"] = struct{}{}
|
||||
continue
|
||||
}
|
||||
for network := range serviceConfig.Networks {
|
||||
serviceNetworks[network] = struct{}{}
|
||||
for nw := range serviceConfig.Networks {
|
||||
serviceNetworks[nw] = struct{}{}
|
||||
}
|
||||
}
|
||||
return serviceNetworks
|
||||
|
@ -95,14 +96,14 @@ func validateExternalNetworks(ctx context.Context, client apiclient.NetworkAPICl
|
|||
// local-scoped networks, so there's no need to inspect them.
|
||||
continue
|
||||
}
|
||||
network, err := client.NetworkInspect(ctx, networkName, types.NetworkInspectOptions{})
|
||||
nw, err := client.NetworkInspect(ctx, networkName, network.InspectOptions{})
|
||||
switch {
|
||||
case errdefs.IsNotFound(err):
|
||||
return fmt.Errorf("network %q is declared as external, but could not be found. You need to create a swarm-scoped network before the stack is deployed", networkName)
|
||||
case err != nil:
|
||||
return err
|
||||
case network.Scope != "swarm":
|
||||
return fmt.Errorf("network %q is declared as external, but it is not in the right scope: %q instead of \"swarm\"", networkName, network.Scope)
|
||||
case nw.Scope != "swarm":
|
||||
return fmt.Errorf("network %q is declared as external, but it is not in the right scope: %q instead of \"swarm\"", networkName, nw.Scope)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
@ -165,8 +166,8 @@ func createNetworks(ctx context.Context, dockerCli command.Cli, namespace conver
|
|||
}
|
||||
|
||||
existingNetworkMap := make(map[string]types.NetworkResource)
|
||||
for _, network := range existingNetworks {
|
||||
existingNetworkMap[network.Name] = network
|
||||
for _, nw := range existingNetworks {
|
||||
existingNetworkMap[nw.Name] = nw
|
||||
}
|
||||
|
||||
for name, createOpts := range networks {
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/docker/cli/internal/test/network"
|
||||
"github.com/docker/docker/api/types"
|
||||
networktypes "github.com/docker/docker/api/types/network"
|
||||
"github.com/pkg/errors"
|
||||
"gotest.tools/v3/assert"
|
||||
)
|
||||
|
@ -50,7 +51,7 @@ func TestValidateExternalNetworks(t *testing.T) {
|
|||
|
||||
for _, testcase := range testcases {
|
||||
fakeClient := &network.FakeClient{
|
||||
NetworkInspectFunc: func(_ context.Context, _ string, _ types.NetworkInspectOptions) (types.NetworkResource, error) {
|
||||
NetworkInspectFunc: func(_ context.Context, _ string, _ networktypes.InspectOptions) (types.NetworkResource, error) {
|
||||
return testcase.inspectResponse, testcase.inspectError
|
||||
},
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
"github.com/docker/cli/cli/command/inspect"
|
||||
flagsHelper "github.com/docker/cli/cli/flags"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -72,7 +73,7 @@ func inspectImages(ctx context.Context, dockerCli command.Cli) inspect.GetRefFun
|
|||
|
||||
func inspectNetwork(ctx context.Context, dockerCli command.Cli) inspect.GetRefFunc {
|
||||
return func(ref string) (any, []byte, error) {
|
||||
return dockerCli.Client().NetworkInspectWithRaw(ctx, ref, types.NetworkInspectOptions{})
|
||||
return dockerCli.Client().NetworkInspectWithRaw(ctx, ref, network.InspectOptions{})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,17 +4,18 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/client"
|
||||
)
|
||||
|
||||
// FakeClient is a fake NetworkAPIClient
|
||||
type FakeClient struct {
|
||||
client.NetworkAPIClient
|
||||
NetworkInspectFunc func(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, error)
|
||||
NetworkInspectFunc func(ctx context.Context, networkID string, options network.InspectOptions) (types.NetworkResource, error)
|
||||
}
|
||||
|
||||
// NetworkInspect fakes inspecting a network
|
||||
func (c *FakeClient) NetworkInspect(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, error) {
|
||||
func (c *FakeClient) NetworkInspect(ctx context.Context, networkID string, options network.InspectOptions) (types.NetworkResource, error) {
|
||||
if c.NetworkInspectFunc != nil {
|
||||
return c.NetworkInspectFunc(ctx, networkID, options)
|
||||
}
|
||||
|
|
|
@ -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.20240516211257-06e3a49d66fa+incompatible
|
||||
github.com/docker/docker v26.1.1-0.20240530195642-e622cea55698+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
|
||||
|
@ -29,7 +29,7 @@ require (
|
|||
github.com/moby/term v0.5.0
|
||||
github.com/morikuni/aec v1.0.0
|
||||
github.com/opencontainers/go-digest v1.0.0
|
||||
github.com/opencontainers/image-spec v1.1.0-rc5
|
||||
github.com/opencontainers/image-spec v1.1.0
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/spf13/cobra v1.8.0
|
||||
|
@ -56,7 +56,7 @@ require (
|
|||
require (
|
||||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||
github.com/Microsoft/hcsshim v0.11.4 // indirect
|
||||
github.com/Microsoft/hcsshim v0.11.5 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
|
|
12
vendor.sum
12
vendor.sum
|
@ -8,8 +8,8 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ
|
|||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
|
||||
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
|
||||
github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8=
|
||||
github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w=
|
||||
github.com/Microsoft/hcsshim v0.11.5 h1:haEcLNpj9Ka1gd3B3tAEs9CpE0c+1IhoL59w/exYU38=
|
||||
github.com/Microsoft/hcsshim v0.11.5/go.mod h1:MV8xMfmECjl5HdO7U/3/hFVnkmSBjAjmA09d4bExKcU=
|
||||
github.com/Shopify/logrus-bugsnag v0.0.0-20170309145241-6dbc35f2c30d h1:hi6J4K6DKrR4/ljxn6SF6nURyu785wKMuQcjt7H3VCQ=
|
||||
github.com/Shopify/logrus-bugsnag v0.0.0-20170309145241-6dbc35f2c30d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
|
@ -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.20240516211257-06e3a49d66fa+incompatible h1:Zp6B3afdBCdGNGM6dxdiThsrmUIJSoBFkFLonLhiO1k=
|
||||
github.com/docker/docker v26.1.1-0.20240516211257-06e3a49d66fa+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker v26.1.1-0.20240530195642-e622cea55698+incompatible h1:ri3VMs8K77n+rXEESbkIW3L2x9h0jsOoJp7Um6x1KUE=
|
||||
github.com/docker/docker v26.1.1-0.20240530195642-e622cea55698+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=
|
||||
|
@ -205,8 +205,8 @@ github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoT
|
|||
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||
github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI=
|
||||
github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8=
|
||||
github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug=
|
||||
github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
|
||||
github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
|
||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
|
|
|
@ -2179,56 +2179,78 @@ definitions:
|
|||
type: "object"
|
||||
properties:
|
||||
Name:
|
||||
description: |
|
||||
Name of the network.
|
||||
type: "string"
|
||||
example: "my_network"
|
||||
Id:
|
||||
description: |
|
||||
ID that uniquely identifies a network on a single machine.
|
||||
type: "string"
|
||||
example: "7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99"
|
||||
Created:
|
||||
description: |
|
||||
Date and time at which the network was created in
|
||||
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
|
||||
type: "string"
|
||||
format: "dateTime"
|
||||
example: "2016-10-19T04:33:30.360899459Z"
|
||||
Scope:
|
||||
description: |
|
||||
The level at which the network exists (e.g. `swarm` for cluster-wide
|
||||
or `local` for machine level)
|
||||
type: "string"
|
||||
example: "local"
|
||||
Driver:
|
||||
description: |
|
||||
The name of the driver used to create the network (e.g. `bridge`,
|
||||
`overlay`).
|
||||
type: "string"
|
||||
example: "overlay"
|
||||
EnableIPv6:
|
||||
description: |
|
||||
Whether the network was created with IPv6 enabled.
|
||||
type: "boolean"
|
||||
example: false
|
||||
IPAM:
|
||||
$ref: "#/definitions/IPAM"
|
||||
Internal:
|
||||
description: |
|
||||
Whether the network is created to only allow internal networking
|
||||
connectivity.
|
||||
type: "boolean"
|
||||
default: false
|
||||
example: false
|
||||
Attachable:
|
||||
description: |
|
||||
Wheter a global / swarm scope network is manually attachable by regular
|
||||
containers from workers in swarm mode.
|
||||
type: "boolean"
|
||||
default: false
|
||||
example: false
|
||||
Ingress:
|
||||
description: |
|
||||
Whether the network is providing the routing-mesh for the swarm cluster.
|
||||
type: "boolean"
|
||||
default: false
|
||||
example: false
|
||||
ConfigFrom:
|
||||
$ref: "#/definitions/ConfigReference"
|
||||
ConfigOnly:
|
||||
description: |
|
||||
Whether the network is a config-only network. Config-only networks are
|
||||
placeholder networks for network configurations to be used by other
|
||||
networks. Config-only networks cannot be used directly to run containers
|
||||
or services.
|
||||
type: "boolean"
|
||||
default: false
|
||||
Containers:
|
||||
description: |
|
||||
Contains endpoints attached to the network.
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
$ref: "#/definitions/NetworkContainer"
|
||||
Options:
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
Labels:
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
example:
|
||||
Name: "net01"
|
||||
Id: "7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99"
|
||||
Created: "2016-10-19T04:33:30.360899459Z"
|
||||
Scope: "local"
|
||||
Driver: "bridge"
|
||||
EnableIPv6: false
|
||||
IPAM:
|
||||
Driver: "default"
|
||||
Config:
|
||||
- Subnet: "172.19.0.0/16"
|
||||
Gateway: "172.19.0.1"
|
||||
Options:
|
||||
foo: "bar"
|
||||
Internal: false
|
||||
Attachable: false
|
||||
Ingress: false
|
||||
Containers:
|
||||
19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c:
|
||||
Name: "test"
|
||||
EndpointID: "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a"
|
||||
|
@ -2236,6 +2258,12 @@ definitions:
|
|||
IPv4Address: "172.19.0.2/16"
|
||||
IPv6Address: ""
|
||||
Options:
|
||||
description: |
|
||||
Network-specific options uses when creating the network.
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
example:
|
||||
com.docker.network.bridge.default_bridge: "true"
|
||||
com.docker.network.bridge.enable_icc: "true"
|
||||
com.docker.network.bridge.enable_ip_masquerade: "true"
|
||||
|
@ -2243,8 +2271,37 @@ definitions:
|
|||
com.docker.network.bridge.name: "docker0"
|
||||
com.docker.network.driver.mtu: "1500"
|
||||
Labels:
|
||||
description: "User-defined key/value metadata."
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
example:
|
||||
com.example.some-label: "some-value"
|
||||
com.example.some-other-label: "some-other-value"
|
||||
Peers:
|
||||
description: |
|
||||
List of peer nodes for an overlay network. This field is only present
|
||||
for overlay networks, and omitted for other network types.
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/PeerInfo"
|
||||
x-nullable: true
|
||||
# TODO: Add Services (only present when "verbose" is set).
|
||||
|
||||
ConfigReference:
|
||||
description: |
|
||||
The config-only network source to provide the configuration for
|
||||
this network.
|
||||
type: "object"
|
||||
properties:
|
||||
Network:
|
||||
description: |
|
||||
The name of the config-only network that provides the network's
|
||||
configuration. The specified network must be an existing config-only
|
||||
network. Only network names are allowed, not network IDs.
|
||||
type: "string"
|
||||
example: "config_only_network_01"
|
||||
|
||||
IPAM:
|
||||
type: "object"
|
||||
properties:
|
||||
|
@ -2252,6 +2309,7 @@ definitions:
|
|||
description: "Name of the IPAM driver to use."
|
||||
type: "string"
|
||||
default: "default"
|
||||
example: "default"
|
||||
Config:
|
||||
description: |
|
||||
List of IPAM configuration options, specified as a map:
|
||||
|
@ -2267,16 +2325,21 @@ definitions:
|
|||
type: "object"
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
example:
|
||||
foo: "bar"
|
||||
|
||||
IPAMConfig:
|
||||
type: "object"
|
||||
properties:
|
||||
Subnet:
|
||||
type: "string"
|
||||
example: "172.20.0.0/16"
|
||||
IPRange:
|
||||
type: "string"
|
||||
example: "172.20.10.0/24"
|
||||
Gateway:
|
||||
type: "string"
|
||||
example: "172.20.10.11"
|
||||
AuxiliaryAddresses:
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
|
@ -2287,14 +2350,53 @@ definitions:
|
|||
properties:
|
||||
Name:
|
||||
type: "string"
|
||||
example: "container_1"
|
||||
EndpointID:
|
||||
type: "string"
|
||||
example: "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a"
|
||||
MacAddress:
|
||||
type: "string"
|
||||
example: "02:42:ac:13:00:02"
|
||||
IPv4Address:
|
||||
type: "string"
|
||||
example: "172.19.0.2/16"
|
||||
IPv6Address:
|
||||
type: "string"
|
||||
example: ""
|
||||
|
||||
PeerInfo:
|
||||
description: |
|
||||
PeerInfo represents one peer of an overlay network.
|
||||
type: "object"
|
||||
properties:
|
||||
Name:
|
||||
description:
|
||||
ID of the peer-node in the Swarm cluster.
|
||||
type: "string"
|
||||
example: "6869d7c1732b"
|
||||
IP:
|
||||
description:
|
||||
IP-address of the peer-node in the Swarm cluster.
|
||||
type: "string"
|
||||
example: "10.133.77.91"
|
||||
|
||||
NetworkCreateResponse:
|
||||
description: "OK response to NetworkCreate operation"
|
||||
type: "object"
|
||||
title: "NetworkCreateResponse"
|
||||
x-go-name: "CreateResponse"
|
||||
required: [Id, Warning]
|
||||
properties:
|
||||
Id:
|
||||
description: "The ID of the created network."
|
||||
type: "string"
|
||||
x-nullable: false
|
||||
example: "b5c4fc71e8022147cd25de22b22173de4e3b170134117172eb595cb91b4e7e5d"
|
||||
Warning:
|
||||
description: "Warnings encountered when creating the container"
|
||||
type: "string"
|
||||
x-nullable: false
|
||||
example: ""
|
||||
|
||||
BuildInfo:
|
||||
type: "object"
|
||||
|
@ -2495,6 +2597,17 @@ definitions:
|
|||
example:
|
||||
- "server_x"
|
||||
- "server_y"
|
||||
DriverOpts:
|
||||
description: |
|
||||
DriverOpts is a mapping of driver options and values. These options
|
||||
are passed directly to the driver and are driver specific.
|
||||
type: "object"
|
||||
x-nullable: true
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
example:
|
||||
com.example.some-label: "some-value"
|
||||
com.example.some-other-label: "some-other-value"
|
||||
|
||||
# Operational data
|
||||
NetworkID:
|
||||
|
@ -2538,17 +2651,6 @@ definitions:
|
|||
type: "integer"
|
||||
format: "int64"
|
||||
example: 64
|
||||
DriverOpts:
|
||||
description: |
|
||||
DriverOpts is a mapping of driver options and values. These options
|
||||
are passed directly to the driver and are driver specific.
|
||||
type: "object"
|
||||
x-nullable: true
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
example:
|
||||
com.example.some-label: "some-value"
|
||||
com.example.some-other-label: "some-other-value"
|
||||
DNSNames:
|
||||
description: |
|
||||
List of all DNS names an endpoint has on a specific network. This
|
||||
|
@ -10060,19 +10162,9 @@ paths:
|
|||
- "application/json"
|
||||
responses:
|
||||
201:
|
||||
description: "No error"
|
||||
description: "Network created successfully"
|
||||
schema:
|
||||
type: "object"
|
||||
title: "NetworkCreateResponse"
|
||||
properties:
|
||||
Id:
|
||||
description: "The ID of the created network."
|
||||
type: "string"
|
||||
Warning:
|
||||
type: "string"
|
||||
example:
|
||||
Id: "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30"
|
||||
Warning: ""
|
||||
$ref: "#/definitions/NetworkCreateResponse"
|
||||
400:
|
||||
description: "bad parameter"
|
||||
schema:
|
||||
|
@ -10104,14 +10196,22 @@ paths:
|
|||
Name:
|
||||
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"
|
||||
default: "bridge"
|
||||
example: "bridge"
|
||||
Scope:
|
||||
description: |
|
||||
The level at which the network exists (e.g. `swarm` for cluster-wide
|
||||
or `local` for machine level).
|
||||
type: "string"
|
||||
Internal:
|
||||
description: "Restrict external access to the network."
|
||||
type: "boolean"
|
||||
|
@ -10120,46 +10220,41 @@ paths:
|
|||
Globally scoped network is manually attachable by regular
|
||||
containers from workers in swarm mode.
|
||||
type: "boolean"
|
||||
example: true
|
||||
Ingress:
|
||||
description: |
|
||||
Ingress network is the network which provides the routing-mesh
|
||||
in swarm mode.
|
||||
type: "boolean"
|
||||
example: false
|
||||
ConfigOnly:
|
||||
description: |
|
||||
Creates a config-only network. Config-only networks are placeholder
|
||||
networks for network configurations to be used by other networks.
|
||||
Config-only networks cannot be used directly to run containers
|
||||
or services.
|
||||
type: "boolean"
|
||||
default: false
|
||||
example: false
|
||||
ConfigFrom:
|
||||
description: |
|
||||
Specifies the source which will provide the configuration for
|
||||
this network. The specified network must be an existing
|
||||
config-only network; see ConfigOnly.
|
||||
$ref: "#/definitions/ConfigReference"
|
||||
IPAM:
|
||||
description: "Optional custom IP scheme for the network."
|
||||
$ref: "#/definitions/IPAM"
|
||||
EnableIPv6:
|
||||
description: "Enable IPv6 on the network."
|
||||
type: "boolean"
|
||||
example: true
|
||||
Options:
|
||||
description: "Network specific options to be used by the drivers."
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
Labels:
|
||||
description: "User-defined key/value metadata."
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
example:
|
||||
Name: "isolated_nw"
|
||||
CheckDuplicate: false
|
||||
Driver: "bridge"
|
||||
EnableIPv6: true
|
||||
IPAM:
|
||||
Driver: "default"
|
||||
Config:
|
||||
- Subnet: "172.20.0.0/16"
|
||||
IPRange: "172.20.10.0/24"
|
||||
Gateway: "172.20.10.11"
|
||||
- Subnet: "2001:db8:abcd::/64"
|
||||
Gateway: "2001:db8:abcd::1011"
|
||||
Options:
|
||||
foo: "bar"
|
||||
Internal: true
|
||||
Attachable: false
|
||||
Ingress: false
|
||||
Options:
|
||||
com.docker.network.bridge.default_bridge: "true"
|
||||
com.docker.network.bridge.enable_icc: "true"
|
||||
com.docker.network.bridge.enable_ip_masquerade: "true"
|
||||
|
@ -10167,6 +10262,11 @@ paths:
|
|||
com.docker.network.bridge.name: "docker0"
|
||||
com.docker.network.driver.mtu: "1500"
|
||||
Labels:
|
||||
description: "User-defined key/value metadata."
|
||||
type: "object"
|
||||
additionalProperties:
|
||||
type: "string"
|
||||
example:
|
||||
com.example.some-label: "some-value"
|
||||
com.example.some-other-label: "some-other-value"
|
||||
tags: ["Network"]
|
||||
|
|
19
vendor/github.com/docker/docker/api/types/network/create_response.go
generated
vendored
Normal file
19
vendor/github.com/docker/docker/api/types/network/create_response.go
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
package network
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// CreateResponse NetworkCreateResponse
|
||||
//
|
||||
// OK response to NetworkCreate operation
|
||||
// swagger:model CreateResponse
|
||||
type CreateResponse struct {
|
||||
|
||||
// The ID of the created network.
|
||||
// Required: true
|
||||
ID string `json:"Id"`
|
||||
|
||||
// Warnings encountered when creating the container
|
||||
// Required: true
|
||||
Warning string `json:"Warning"`
|
||||
}
|
|
@ -18,6 +18,7 @@ type EndpointSettings struct {
|
|||
// Once the container is running, it becomes operational data (it may contain a
|
||||
// generated address).
|
||||
MacAddress string
|
||||
DriverOpts map[string]string
|
||||
// Operational data
|
||||
NetworkID string
|
||||
EndpointID string
|
||||
|
@ -27,7 +28,6 @@ type EndpointSettings struct {
|
|||
IPv6Gateway string
|
||||
GlobalIPv6Address string
|
||||
GlobalIPv6PrefixLen int
|
||||
DriverOpts map[string]string
|
||||
// DNSNames holds all the (non fully qualified) DNS names associated to this endpoint. First entry is used to
|
||||
// generate PTR records.
|
||||
DNSNames []string
|
||||
|
|
|
@ -17,6 +17,26 @@ const (
|
|||
NetworkNat = "nat"
|
||||
)
|
||||
|
||||
// InspectOptions holds parameters to inspect network.
|
||||
type InspectOptions struct {
|
||||
Scope string
|
||||
Verbose bool
|
||||
}
|
||||
|
||||
// ConnectOptions represents the data to be used to connect a container to the
|
||||
// network.
|
||||
type ConnectOptions struct {
|
||||
Container string
|
||||
EndpointConfig *EndpointSettings `json:",omitempty"`
|
||||
}
|
||||
|
||||
// DisconnectOptions represents the data to be used to disconnect a container
|
||||
// from the network.
|
||||
type DisconnectOptions struct {
|
||||
Container string
|
||||
Force bool
|
||||
}
|
||||
|
||||
// Address represents an IP address
|
||||
type Address struct {
|
||||
Addr string
|
||||
|
@ -45,6 +65,16 @@ type ServiceInfo struct {
|
|||
Tasks []Task
|
||||
}
|
||||
|
||||
// EndpointResource contains network resources allocated and used for a
|
||||
// container in a network.
|
||||
type EndpointResource struct {
|
||||
Name string
|
||||
EndpointID string
|
||||
MacAddress string
|
||||
IPv4Address string
|
||||
IPv6Address string
|
||||
}
|
||||
|
||||
// NetworkingConfig represents the container's networking configuration for each of its interfaces
|
||||
// Carries the networking configs specified in the `docker run` and `docker network connect` commands
|
||||
type NetworkingConfig struct {
|
||||
|
|
|
@ -437,68 +437,35 @@ type NetworkResource struct {
|
|||
Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster.
|
||||
ConfigFrom network.ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network.
|
||||
ConfigOnly bool // ConfigOnly 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.
|
||||
Containers map[string]EndpointResource // Containers contains endpoints belonging to the network
|
||||
Containers map[string]network.EndpointResource // Containers contains endpoints belonging to the network
|
||||
Options map[string]string // Options holds the network specific options to use for when creating the network
|
||||
Labels map[string]string // Labels holds metadata specific to the network being created
|
||||
Peers []network.PeerInfo `json:",omitempty"` // List of peer nodes for an overlay network
|
||||
Services map[string]network.ServiceInfo `json:",omitempty"`
|
||||
}
|
||||
|
||||
// EndpointResource contains network resources allocated and used for a container in a network
|
||||
type EndpointResource struct {
|
||||
Name string
|
||||
EndpointID string
|
||||
MacAddress string
|
||||
IPv4Address string
|
||||
IPv6Address string
|
||||
}
|
||||
|
||||
// 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
|
||||
Scope string
|
||||
EnableIPv6 bool
|
||||
IPAM *network.IPAM
|
||||
Internal bool
|
||||
Attachable bool
|
||||
Ingress bool
|
||||
ConfigOnly bool
|
||||
ConfigFrom *network.ConfigReference
|
||||
Options map[string]string
|
||||
Labels map[string]string
|
||||
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 // 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
|
||||
}
|
||||
|
||||
// NetworkCreateResponse is the response message sent by the server for network create call
|
||||
type NetworkCreateResponse struct {
|
||||
ID string `json:"Id"`
|
||||
Warning string
|
||||
}
|
||||
|
||||
// NetworkConnect represents the data to be used to connect a container to the network
|
||||
type NetworkConnect struct {
|
||||
Container string
|
||||
EndpointConfig *network.EndpointSettings `json:",omitempty"`
|
||||
}
|
||||
|
||||
// NetworkDisconnect represents the data to be used to disconnect a container from the network
|
||||
type NetworkDisconnect struct {
|
||||
Container string
|
||||
Force bool
|
||||
}
|
||||
|
||||
// NetworkInspectOptions holds parameters to inspect network
|
||||
type NetworkInspectOptions struct {
|
||||
Scope string
|
||||
Verbose bool
|
||||
Name string // Name is the requested name of the network.
|
||||
}
|
||||
|
||||
// DiskUsageObject represents an object type used for disk usage query filtering.
|
||||
|
|
|
@ -2,6 +2,7 @@ package types
|
|||
|
||||
import (
|
||||
"github.com/docker/docker/api/types/image"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
)
|
||||
|
||||
// ImageImportOptions holds information to import images from the client host.
|
||||
|
@ -33,3 +34,28 @@ type ImageListOptions = image.ListOptions
|
|||
//
|
||||
// Deprecated: use [image.RemoveOptions].
|
||||
type ImageRemoveOptions = image.RemoveOptions
|
||||
|
||||
// NetworkCreateResponse is the response message sent by the server for network create call.
|
||||
//
|
||||
// Deprecated: use [network.CreateResponse].
|
||||
type NetworkCreateResponse = network.CreateResponse
|
||||
|
||||
// NetworkInspectOptions holds parameters to inspect network.
|
||||
//
|
||||
// Deprecated: use [network.InspectOptions].
|
||||
type NetworkInspectOptions = network.InspectOptions
|
||||
|
||||
// NetworkConnect represents the data to be used to connect a container to the network
|
||||
//
|
||||
// Deprecated: use [network.ConnectOptions].
|
||||
type NetworkConnect = network.ConnectOptions
|
||||
|
||||
// NetworkDisconnect represents the data to be used to disconnect a container from the network
|
||||
//
|
||||
// Deprecated: use [network.DisconnectOptions].
|
||||
type NetworkDisconnect = network.DisconnectOptions
|
||||
|
||||
// EndpointResource contains network resources allocated and used for a container in a network.
|
||||
//
|
||||
// Deprecated: use [network.EndpointResource].
|
||||
type EndpointResource = network.EndpointResource
|
||||
|
|
|
@ -108,10 +108,10 @@ 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) (types.NetworkCreateResponse, error)
|
||||
NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (network.CreateResponse, error)
|
||||
NetworkDisconnect(ctx context.Context, network, container string, force bool) error
|
||||
NetworkInspect(ctx context.Context, network string, options types.NetworkInspectOptions) (types.NetworkResource, error)
|
||||
NetworkInspectWithRaw(ctx context.Context, network string, options types.NetworkInspectOptions) (types.NetworkResource, []byte, error)
|
||||
NetworkInspect(ctx context.Context, network string, options network.InspectOptions) (types.NetworkResource, error)
|
||||
NetworkInspectWithRaw(ctx context.Context, network string, options network.InspectOptions) (types.NetworkResource, []byte, error)
|
||||
NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)
|
||||
NetworkRemove(ctx context.Context, network string) error
|
||||
NetworksPrune(ctx context.Context, pruneFilter filters.Args) (types.NetworksPruneReport, error)
|
||||
|
|
|
@ -3,13 +3,12 @@ package client // import "github.com/docker/docker/client"
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
)
|
||||
|
||||
// NetworkConnect connects a container to an existent network in the docker host.
|
||||
func (cli *Client) NetworkConnect(ctx context.Context, networkID, containerID string, config *network.EndpointSettings) error {
|
||||
nc := types.NetworkConnect{
|
||||
nc := network.ConnectOptions{
|
||||
Container: containerID,
|
||||
EndpointConfig: config,
|
||||
}
|
||||
|
|
|
@ -5,12 +5,13 @@ import (
|
|||
"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) (types.NetworkCreateResponse, error) {
|
||||
var response types.NetworkCreateResponse
|
||||
func (cli *Client) NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (network.CreateResponse, error) {
|
||||
var response network.CreateResponse
|
||||
|
||||
// Make sure we negotiated (if the client is configured to do so),
|
||||
// as code below contains API-version specific handling of options.
|
||||
|
|
|
@ -3,12 +3,15 @@ package client // import "github.com/docker/docker/client"
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
)
|
||||
|
||||
// NetworkDisconnect disconnects a container from an existent network in the docker host.
|
||||
func (cli *Client) NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error {
|
||||
nd := types.NetworkDisconnect{Container: containerID, Force: force}
|
||||
nd := network.DisconnectOptions{
|
||||
Container: containerID,
|
||||
Force: force,
|
||||
}
|
||||
resp, err := cli.post(ctx, "/networks/"+networkID+"/disconnect", nil, nd, nil)
|
||||
ensureReaderClosed(resp)
|
||||
return err
|
||||
|
|
|
@ -8,16 +8,17 @@ import (
|
|||
"net/url"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
)
|
||||
|
||||
// NetworkInspect returns the information for a specific network configured in the docker host.
|
||||
func (cli *Client) NetworkInspect(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, error) {
|
||||
func (cli *Client) NetworkInspect(ctx context.Context, networkID string, options network.InspectOptions) (types.NetworkResource, error) {
|
||||
networkResource, _, err := cli.NetworkInspectWithRaw(ctx, networkID, options)
|
||||
return networkResource, err
|
||||
}
|
||||
|
||||
// NetworkInspectWithRaw returns the information for a specific network configured in the docker host and its raw representation.
|
||||
func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, []byte, error) {
|
||||
func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string, options network.InspectOptions) (types.NetworkResource, []byte, error) {
|
||||
if networkID == "" {
|
||||
return types.NetworkResource{}, nil, objectNotFoundError{object: "network", id: networkID}
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ func magicNumberMatcher(m []byte) matcher {
|
|||
// zstdMatcher detects zstd compression algorithm.
|
||||
// Zstandard compressed data is made of one or more frames.
|
||||
// There are two frame formats defined by Zstandard: Zstandard frames and Skippable frames.
|
||||
// See https://tools.ietf.org/id/draft-kucherawy-dispatch-zstd-00.html#rfc.section.2 for more details.
|
||||
// See https://datatracker.ietf.org/doc/html/rfc8878#section-3 for more details.
|
||||
func zstdMatcher() matcher {
|
||||
return func(source []byte) bool {
|
||||
if bytes.HasPrefix(source, zstdMagic) {
|
||||
|
|
|
@ -21,12 +21,20 @@ const (
|
|||
// MediaTypeLayoutHeader specifies the media type for the oci-layout.
|
||||
MediaTypeLayoutHeader = "application/vnd.oci.layout.header.v1+json"
|
||||
|
||||
// MediaTypeImageManifest specifies the media type for an image manifest.
|
||||
MediaTypeImageManifest = "application/vnd.oci.image.manifest.v1+json"
|
||||
|
||||
// MediaTypeImageIndex specifies the media type for an image index.
|
||||
MediaTypeImageIndex = "application/vnd.oci.image.index.v1+json"
|
||||
|
||||
// MediaTypeImageManifest specifies the media type for an image manifest.
|
||||
MediaTypeImageManifest = "application/vnd.oci.image.manifest.v1+json"
|
||||
|
||||
// MediaTypeImageConfig specifies the media type for the image configuration.
|
||||
MediaTypeImageConfig = "application/vnd.oci.image.config.v1+json"
|
||||
|
||||
// MediaTypeEmptyJSON specifies the media type for an unused blob containing the value "{}".
|
||||
MediaTypeEmptyJSON = "application/vnd.oci.empty.v1+json"
|
||||
)
|
||||
|
||||
const (
|
||||
// MediaTypeImageLayer is the media type used for layers referenced by the manifest.
|
||||
MediaTypeImageLayer = "application/vnd.oci.image.layer.v1.tar"
|
||||
|
||||
|
@ -37,7 +45,15 @@ const (
|
|||
// MediaTypeImageLayerZstd is the media type used for zstd compressed
|
||||
// layers referenced by the manifest.
|
||||
MediaTypeImageLayerZstd = "application/vnd.oci.image.layer.v1.tar+zstd"
|
||||
)
|
||||
|
||||
// Non-distributable layer media-types.
|
||||
//
|
||||
// Deprecated: Non-distributable layers are deprecated, and not recommended
|
||||
// for future use. Implementations SHOULD NOT produce new non-distributable
|
||||
// layers.
|
||||
// https://github.com/opencontainers/image-spec/pull/965
|
||||
const (
|
||||
// MediaTypeImageLayerNonDistributable is the media type for layers referenced by
|
||||
// the manifest but with distribution restrictions.
|
||||
//
|
||||
|
@ -66,10 +82,4 @@ const (
|
|||
// layers.
|
||||
// https://github.com/opencontainers/image-spec/pull/965
|
||||
MediaTypeImageLayerNonDistributableZstd = "application/vnd.oci.image.layer.nondistributable.v1.tar+zstd"
|
||||
|
||||
// MediaTypeImageConfig specifies the media type for the image configuration.
|
||||
MediaTypeImageConfig = "application/vnd.oci.image.config.v1+json"
|
||||
|
||||
// MediaTypeEmptyJSON specifies the media type for an unused blob containing the value `{}`
|
||||
MediaTypeEmptyJSON = "application/vnd.oci.empty.v1+json"
|
||||
)
|
||||
|
|
|
@ -25,7 +25,7 @@ const (
|
|||
VersionPatch = 0
|
||||
|
||||
// VersionDev indicates development branch. Releases will be empty string.
|
||||
VersionDev = "-rc.5"
|
||||
VersionDev = ""
|
||||
)
|
||||
|
||||
// Version is the specification version that the package types support.
|
||||
|
|
|
@ -12,8 +12,8 @@ github.com/Microsoft/go-winio/internal/fs
|
|||
github.com/Microsoft/go-winio/internal/socket
|
||||
github.com/Microsoft/go-winio/internal/stringbuffer
|
||||
github.com/Microsoft/go-winio/pkg/guid
|
||||
# github.com/Microsoft/hcsshim v0.11.4
|
||||
## explicit; go 1.18
|
||||
# github.com/Microsoft/hcsshim v0.11.5
|
||||
## explicit; go 1.21
|
||||
github.com/Microsoft/hcsshim/osversion
|
||||
# github.com/beorn7/perks v1.0.1
|
||||
## explicit; go 1.11
|
||||
|
@ -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.20240516211257-06e3a49d66fa+incompatible
|
||||
# github.com/docker/docker v26.1.1-0.20240530195642-e622cea55698+incompatible
|
||||
## explicit
|
||||
github.com/docker/docker/api
|
||||
github.com/docker/docker/api/types
|
||||
|
@ -224,7 +224,7 @@ github.com/morikuni/aec
|
|||
# github.com/opencontainers/go-digest v1.0.0
|
||||
## explicit; go 1.13
|
||||
github.com/opencontainers/go-digest
|
||||
# github.com/opencontainers/image-spec v1.1.0-rc5
|
||||
# github.com/opencontainers/image-spec v1.1.0
|
||||
## explicit; go 1.18
|
||||
github.com/opencontainers/image-spec/specs-go
|
||||
github.com/opencontainers/image-spec/specs-go/v1
|
||||
|
|
Loading…
Reference in New Issue