Compare commits

..

12 Commits

Author SHA1 Message Date
b89b069082 Merge pull request #6416 from vvoland/update-docker
Some checks failed
build / bin-image (push) Has been cancelled
build / prepare-plugins (push) Has been cancelled
build / plugins (push) Has been cancelled
codeql / codeql (push) Has been cancelled
e2e / tests (alpine, 23, connhelper-ssh) (push) Has been cancelled
e2e / tests (alpine, 23, local) (push) Has been cancelled
e2e / tests (alpine, 26, connhelper-ssh) (push) Has been cancelled
e2e / tests (alpine, 26, local) (push) Has been cancelled
e2e / tests (alpine, 27, connhelper-ssh) (push) Has been cancelled
e2e / tests (alpine, 27, local) (push) Has been cancelled
e2e / tests (alpine, 28, connhelper-ssh) (push) Has been cancelled
e2e / tests (alpine, 28, local) (push) Has been cancelled
e2e / tests (debian, 23, connhelper-ssh) (push) Has been cancelled
e2e / tests (debian, 23, local) (push) Has been cancelled
e2e / tests (debian, 26, connhelper-ssh) (push) Has been cancelled
e2e / tests (debian, 26, local) (push) Has been cancelled
e2e / tests (debian, 27, connhelper-ssh) (push) Has been cancelled
e2e / tests (debian, 27, local) (push) Has been cancelled
e2e / tests (debian, 28, connhelper-ssh) (push) Has been cancelled
e2e / tests (debian, 28, local) (push) Has been cancelled
test / ctn (push) Has been cancelled
test / host (macos-13) (push) Has been cancelled
test / host (macos-14) (push) Has been cancelled
validate / validate (lint) (push) Has been cancelled
validate / validate (shellcheck) (push) Has been cancelled
validate / validate (update-authors) (push) Has been cancelled
validate / validate (validate-vendor) (push) Has been cancelled
validate / validate-md (push) Has been cancelled
validate / validate-make (manpages) (push) Has been cancelled
validate / validate-make (yamldocs) (push) Has been cancelled
[28.x] vendor: github.com/docker/docker v28.4.0-rc.2-dev (5d5332b00c76)
2025-09-02 12:37:23 +02:00
9deb5e9cd3 vendor: github.com/docker/docker v28.4.0-rc.2-dev (5d5332b00c76)
full diff: https://github.com/docker/docker/compare/v28.4.0-rc.1...5d5332b00c76

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-09-02 12:15:13 +02:00
e8be20bc9c Merge pull request #6413 from thaJeztah/28.x_backport_deprecate_OauthLoginEscapeHatchEnvVar
[28.x backport] cli/command/registry: deprecate OauthLoginEscapeHatchEnvVar
2025-09-01 18:05:08 +02:00
f2cd1979c0 Merge pull request #6411 from thaJeztah/28.x_backport_deprecate_ReexecEnvvar
[28.x backport] cli-plugins/manager: deprecate ReexecEnvvar
2025-09-01 17:57:49 +02:00
991d942cc3 cli/command/registry: deprecate OauthLoginEscapeHatchEnvVar
This const was added in 846ecf59ff, but
only used internally. This patch deprecates the const, to be removed
in the next release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 18cdc25bb4)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-01 17:47:37 +02:00
8e49313c0c cli-plugins/manager: deprecate ReexecEnvvar
This alias was added in 4321293972, which is
part of v28.0, but did not deprecate them. They are no longer used in the
CLI itself, but may be used by cli-plugin implementations.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6fa7d18320)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-01 17:37:27 +02:00
6cd42da462 Merge pull request #6409 from thaJeztah/28.x_bump_engine
[28.x] vendor: github.com/docker/docker v28.4.0-rc.1
2025-09-01 13:14:46 +02:00
2b9489d827 [28.x] vendor: github.com/docker/docker v28.4.0-rc.1
full diff: https://github.com/moby/moby/compare/02b4a1a3decc...v28.4.0-rc.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-01 11:24:20 +02:00
fbeae8516b Merge pull request #6405 from thaJeztah/28.x_backport_deprecate_nocomplete
[28.x backport] cli/command/completion: deprecate NoComplete
2025-09-01 09:13:54 +02:00
d593e61275 Merge pull request #6403 from thaJeztah/28.x_backport_deprecate_context_funcs
[28.x backport] cli/command/context: deprecate exported types and functions
2025-09-01 09:12:27 +02:00
139968dff2 cli/command/completion: deprecate NoComplete
This function was an exact duplicate of [cobra.NoFileCompletions], so
deprecating it in favor of that.

[cobra.NoFileCompletions]: https://pkg.go.dev/github.com/spf13/cobra@v1.9.1#NoFileCompletions

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2827d037ba)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-30 12:24:11 +02:00
925db59377 cli/command/context: deprecate exported types and functions
These functions and types are shallow wrappers around the context
store and were intended for internal use as implementation for the
CLI itself.

They were exported in 3126920af1 to be
used by plugins and Docker Desktop. However, there's currently no public
uses of this, and Docker Desktop does not use these functions.

This patch deprecates the exported functions as they were meant to be
implementation specific for the CLI. If there's a need to provide
utilities for manipulating the context-store other than through the
CLI itself, we can consider creating an SDK for that purpose.

This deprecates:

- `RunCreate` and `CreateOptions`
- `RunExport` and `ExportOptions`
- `RunImport`
- `RunRemove` and `RemoveOptions`
- `RunUpdate` and `UpdateOptions`
- `RunUse`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 95eeafa551)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-30 12:13:27 +02:00
68 changed files with 352 additions and 270 deletions

View File

@ -23,6 +23,8 @@ const (
// used to originally invoke the docker CLI when executing a
// plugin. Assuming $PATH and $CWD remain unchanged this should allow
// the plugin to re-execute the original CLI.
//
// Deprecated: use [metadata.ReexecEnvvar]. This alias will be removed in the next release.
ReexecEnvvar = metadata.ReexecEnvvar
)

View File

@ -8,7 +8,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/internal/prompt"
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types/build"
@ -50,7 +49,7 @@ func newPruneCommand(dockerCLI command.Cli) *cobra.Command {
return nil
},
Annotations: map[string]string{"version": "1.39"},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -6,7 +6,6 @@ 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/checkpoint"
"github.com/spf13/cobra"
)
@ -30,7 +29,7 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command {
opts.checkpoint = args[1]
return runCreate(cmd.Context(), dockerCli, opts)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -141,7 +141,9 @@ func FileNames(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCom
return nil, cobra.ShellCompDirectiveDefault
}
// NoComplete is used for commands where there's no relevant completion
// NoComplete is used for commands where there's no relevant completion.
//
// Deprecated: use [cobra.NoFileCompletions]. This function will be removed in the next release.
func NoComplete(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
return nil, cobra.ShellCompDirectiveNoFileComp
}

View File

@ -288,12 +288,6 @@ func TestCompleteNetworkNames(t *testing.T) {
}
}
func TestCompleteNoComplete(t *testing.T) {
values, directives := NoComplete(nil, nil, "")
assert.Check(t, is.Equal(directives, cobra.ShellCompDirectiveNoFileComp))
assert.Check(t, is.Len(values, 0))
}
func TestCompletePlatforms(t *testing.T) {
values, directives := Platforms(nil, nil, "")
assert.Check(t, is.Equal(directives&cobra.ShellCompDirectiveNoFileComp, cobra.ShellCompDirectiveNoFileComp), "Should not perform file completion")

View File

@ -7,7 +7,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types/swarm"
"github.com/moby/sys/sequential"
@ -47,7 +46,7 @@ func newConfigCreateCommand(dockerCLI command.Cli) *cobra.Command {
createOpts.file = args[1]
return runCreate(cmd.Context(), dockerCLI, createOpts)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()
flags.VarP(&createOpts.labels, "label", "l", "Config labels")

View File

@ -6,7 +6,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
flagsHelper "github.com/docker/cli/cli/flags"
"github.com/docker/cli/opts"
@ -42,7 +41,7 @@ func newConfigListCommand(dockerCLI command.Cli) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
return runList(cmd.Context(), dockerCLI, listOpts)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -105,7 +105,7 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
// Set a default completion function if none was set. We don't look
// up if it does already have one set, because Cobra does this for
// us, and returns an error (which we ignore for this reason).
_ = cmd.RegisterFlagCompletionFunc(flag.Name, completion.NoComplete)
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
})
return cmd

View File

@ -6,7 +6,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
flagsHelper "github.com/docker/cli/cli/flags"
"github.com/docker/cli/opts"
@ -50,7 +49,7 @@ func newPsCommand(dockerCLI command.Cli) *cobra.Command {
"category-top": "3",
"aliases": "docker container ls, docker container list, docker container ps, docker ps",
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -6,7 +6,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/internal/prompt"
"github.com/docker/cli/opts"
"github.com/docker/go-units"
@ -45,7 +44,7 @@ func newPruneCommand(dockerCLI command.Cli) *cobra.Command {
return nil
},
Annotations: map[string]string{"version": "1.25"},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -84,7 +84,7 @@ func newRunCommand(dockerCLI command.Cli) *cobra.Command {
// Set a default completion function if none was set. We don't look
// up if it does already have one set, because Cobra does this for
// us, and returns an error (which we ignore for this reason).
_ = cmd.RegisterFlagCompletionFunc(flag.Name, completion.NoComplete)
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
})
return cmd

View File

@ -11,7 +11,6 @@ import (
"github.com/containerd/errdefs"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter/tabwriter"
"github.com/docker/cli/cli/context/docker"
"github.com/docker/cli/cli/context/store"
@ -19,6 +18,8 @@ import (
)
// CreateOptions are the options used for creating a context
//
// Deprecated: this type was for internal use and will be removed in the next release.
type CreateOptions struct {
Name string
Description string
@ -30,6 +31,18 @@ type CreateOptions struct {
metaData map[string]any
}
// createOptions are the options used for creating a context
type createOptions struct {
name string
description string
endpoint map[string]string
from string
// Additional Metadata to store in the context. This option is not
// currently exposed to the user.
metaData map[string]any
}
func longCreateDescription() string {
buf := bytes.NewBuffer(nil)
buf.WriteString("Create a context\n\nDocker endpoint config:\n\n")
@ -44,52 +57,68 @@ func longCreateDescription() string {
}
func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
opts := &CreateOptions{}
opts := createOptions{}
cmd := &cobra.Command{
Use: "create [OPTIONS] CONTEXT",
Short: "Create a context",
Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.Name = args[0]
return RunCreate(dockerCLI, opts)
opts.name = args[0]
return runCreate(dockerCLI, &opts)
},
Long: longCreateDescription(),
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()
flags.StringVar(&opts.Description, "description", "", "Description of the context")
flags.StringToStringVar(&opts.Docker, "docker", nil, "set the docker endpoint")
flags.StringVar(&opts.From, "from", "", "create context from a named context")
flags.StringVar(&opts.description, "description", "", "Description of the context")
flags.StringToStringVar(&opts.endpoint, "docker", nil, "set the docker endpoint")
flags.StringVar(&opts.from, "from", "", "create context from a named context")
return cmd
}
// RunCreate creates a Docker context
// Deprecated: this function was for internal use and will be removed in the next release.
func RunCreate(dockerCLI command.Cli, o *CreateOptions) error {
if o == nil {
o = &CreateOptions{}
}
return runCreate(dockerCLI, &createOptions{
name: o.Name,
description: o.Description,
endpoint: o.Docker,
metaData: o.metaData,
})
}
// runCreate creates a Docker context
func runCreate(dockerCLI command.Cli, opts *createOptions) error {
s := dockerCLI.ContextStore()
err := checkContextNameForCreation(s, o.Name)
err := checkContextNameForCreation(s, opts.name)
if err != nil {
return err
}
switch {
case o.From == "" && o.Docker == nil:
err = createFromExistingContext(s, dockerCLI.CurrentContext(), o)
case o.From != "":
err = createFromExistingContext(s, o.From, o)
case opts.from == "" && opts.endpoint == nil:
err = createFromExistingContext(s, dockerCLI.CurrentContext(), opts)
case opts.from != "":
err = createFromExistingContext(s, opts.from, opts)
default:
err = createNewContext(s, o)
err = createNewContext(s, opts)
}
if err == nil {
_, _ = fmt.Fprintln(dockerCLI.Out(), o.Name)
_, _ = fmt.Fprintf(dockerCLI.Err(), "Successfully created context %q\n", o.Name)
_, _ = fmt.Fprintln(dockerCLI.Out(), opts.name)
_, _ = fmt.Fprintf(dockerCLI.Err(), "Successfully created context %q\n", opts.name)
}
return err
}
func createNewContext(contextStore store.ReaderWriter, o *CreateOptions) error {
if o.Docker == nil {
func createNewContext(contextStore store.ReaderWriter, opts *createOptions) error {
if opts.endpoint == nil {
return errors.New("docker endpoint configuration is required")
}
dockerEP, dockerTLS, err := getDockerEndpointMetadataAndTLS(contextStore, o.Docker)
dockerEP, dockerTLS, err := getDockerEndpointMetadataAndTLS(contextStore, opts.endpoint)
if err != nil {
return fmt.Errorf("unable to create docker endpoint config: %w", err)
}
@ -98,10 +127,10 @@ func createNewContext(contextStore store.ReaderWriter, o *CreateOptions) error {
docker.DockerEndpoint: dockerEP,
},
Metadata: command.DockerContext{
Description: o.Description,
AdditionalFields: o.metaData,
Description: opts.description,
AdditionalFields: opts.metaData,
},
Name: o.Name,
Name: opts.name,
}
contextTLSData := store.ContextTLSData{}
if dockerTLS != nil {
@ -115,7 +144,7 @@ func createNewContext(contextStore store.ReaderWriter, o *CreateOptions) error {
if err := contextStore.CreateOrUpdate(contextMetadata); err != nil {
return err
}
return contextStore.ResetTLSMaterial(o.Name, &contextTLSData)
return contextStore.ResetTLSMaterial(opts.name, &contextTLSData)
}
func checkContextNameForCreation(s store.Reader, name string) error {
@ -131,16 +160,16 @@ func checkContextNameForCreation(s store.Reader, name string) error {
return nil
}
func createFromExistingContext(s store.ReaderWriter, fromContextName string, o *CreateOptions) error {
if len(o.Docker) != 0 {
func createFromExistingContext(s store.ReaderWriter, fromContextName string, opts *createOptions) error {
if len(opts.endpoint) != 0 {
return errors.New("cannot use --docker flag when --from is set")
}
reader := store.Export(fromContextName, &descriptionDecorator{
Reader: s,
description: o.Description,
description: opts.description,
})
defer reader.Close()
return store.Import(o.Name, s, reader)
return store.Import(opts.name, s, reader)
}
type descriptionDecorator struct {

View File

@ -60,7 +60,7 @@ func TestCreate(t *testing.T) {
assert.NilError(t, cli.ContextStore().CreateOrUpdate(store.Metadata{Name: "existing-context"}))
tests := []struct {
doc string
options CreateOptions
options createOptions
expecterErr string
}{
{
@ -69,30 +69,30 @@ func TestCreate(t *testing.T) {
},
{
doc: "reserved name",
options: CreateOptions{
Name: "default",
options: createOptions{
name: "default",
},
expecterErr: `"default" is a reserved context name`,
},
{
doc: "whitespace-only name",
options: CreateOptions{
Name: " ",
options: createOptions{
name: " ",
},
expecterErr: `context name " " is invalid`,
},
{
doc: "existing context",
options: CreateOptions{
Name: "existing-context",
options: createOptions{
name: "existing-context",
},
expecterErr: `context "existing-context" already exists`,
},
{
doc: "invalid docker host",
options: CreateOptions{
Name: "invalid-docker-host",
Docker: map[string]string{
options: createOptions{
name: "invalid-docker-host",
endpoint: map[string]string{
"host": "some///invalid/host",
},
},
@ -100,27 +100,27 @@ func TestCreate(t *testing.T) {
},
{
doc: "ssh host with skip-tls-verify=false",
options: CreateOptions{
Name: "skip-tls-verify-false",
Docker: map[string]string{
options: createOptions{
name: "skip-tls-verify-false",
endpoint: map[string]string{
"host": "ssh://example.com,skip-tls-verify=false",
},
},
},
{
doc: "ssh host with skip-tls-verify=true",
options: CreateOptions{
Name: "skip-tls-verify-true",
Docker: map[string]string{
options: createOptions{
name: "skip-tls-verify-true",
endpoint: map[string]string{
"host": "ssh://example.com,skip-tls-verify=true",
},
},
},
{
doc: "ssh host with skip-tls-verify=INVALID",
options: CreateOptions{
Name: "skip-tls-verify-invalid",
Docker: map[string]string{
options: createOptions{
name: "skip-tls-verify-invalid",
endpoint: map[string]string{
"host": "ssh://example.com",
"skip-tls-verify": "INVALID",
},
@ -129,9 +129,9 @@ func TestCreate(t *testing.T) {
},
{
doc: "unknown option",
options: CreateOptions{
Name: "unknown-option",
Docker: map[string]string{
options: createOptions{
name: "unknown-option",
endpoint: map[string]string{
"UNKNOWN": "value",
},
},
@ -140,7 +140,7 @@ func TestCreate(t *testing.T) {
}
for _, tc := range tests {
t.Run(tc.doc, func(t *testing.T) {
err := RunCreate(cli, &tc.options)
err := runCreate(cli, &tc.options)
if tc.expecterErr == "" {
assert.NilError(t, err)
} else {
@ -159,9 +159,9 @@ func assertContextCreateLogging(t *testing.T, cli *test.FakeCli, n string) {
func TestCreateOrchestratorEmpty(t *testing.T) {
cli := makeFakeCli(t)
err := RunCreate(cli, &CreateOptions{
Name: "test",
Docker: map[string]string{},
err := runCreate(cli, &createOptions{
name: "test",
endpoint: map[string]string{},
})
assert.NilError(t, err)
assertContextCreateLogging(t, cli, "test")
@ -187,20 +187,20 @@ func TestCreateFromContext(t *testing.T) {
cli := makeFakeCli(t)
cli.ResetOutputBuffers()
assert.NilError(t, RunCreate(cli, &CreateOptions{
Name: "original",
Description: "original description",
Docker: map[string]string{
assert.NilError(t, runCreate(cli, &createOptions{
name: "original",
description: "original description",
endpoint: map[string]string{
keyHost: "tcp://42.42.42.42:2375",
},
}))
assertContextCreateLogging(t, cli, "original")
cli.ResetOutputBuffers()
assert.NilError(t, RunCreate(cli, &CreateOptions{
Name: "dummy",
Description: "dummy description",
Docker: map[string]string{
assert.NilError(t, runCreate(cli, &createOptions{
name: "dummy",
description: "dummy description",
endpoint: map[string]string{
keyHost: "tcp://24.24.24.24:2375",
},
}))
@ -211,11 +211,11 @@ func TestCreateFromContext(t *testing.T) {
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
cli.ResetOutputBuffers()
err := RunCreate(cli, &CreateOptions{
From: "original",
Name: tc.name,
Description: tc.description,
Docker: tc.docker,
err := runCreate(cli, &createOptions{
from: "original",
name: tc.name,
description: tc.description,
endpoint: tc.docker,
})
assert.NilError(t, err)
assertContextCreateLogging(t, cli, tc.name)
@ -251,10 +251,10 @@ func TestCreateFromCurrent(t *testing.T) {
cli := makeFakeCli(t)
cli.ResetOutputBuffers()
assert.NilError(t, RunCreate(cli, &CreateOptions{
Name: "original",
Description: "original description",
Docker: map[string]string{
assert.NilError(t, runCreate(cli, &createOptions{
name: "original",
description: "original description",
endpoint: map[string]string{
keyHost: "tcp://42.42.42.42:2375",
},
}))
@ -265,9 +265,9 @@ func TestCreateFromCurrent(t *testing.T) {
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
cli.ResetOutputBuffers()
err := RunCreate(cli, &CreateOptions{
Name: tc.name,
Description: tc.description,
err := runCreate(cli, &createOptions{
name: tc.name,
description: tc.description,
})
assert.NilError(t, err)
assertContextCreateLogging(t, cli, tc.name)

View File

@ -21,14 +21,11 @@ func TestExportImportWithFile(t *testing.T) {
"MyCustomMetadata": t.Name(),
})
cli.ErrBuffer().Reset()
assert.NilError(t, RunExport(cli, &ExportOptions{
ContextName: "test",
Dest: contextFile,
}))
assert.NilError(t, runExport(cli, "test", contextFile))
assert.Equal(t, cli.ErrBuffer().String(), fmt.Sprintf("Written file %q\n", contextFile))
cli.OutBuffer().Reset()
cli.ErrBuffer().Reset()
assert.NilError(t, RunImport(cli, "test2", contextFile))
assert.NilError(t, runImport(cli, "test2", contextFile))
context1, err := cli.ContextStore().GetMetadata("test")
assert.NilError(t, err)
context2, err := cli.ContextStore().GetMetadata("test2")
@ -55,15 +52,12 @@ func TestExportImportPipe(t *testing.T) {
})
cli.ErrBuffer().Reset()
cli.OutBuffer().Reset()
assert.NilError(t, RunExport(cli, &ExportOptions{
ContextName: "test",
Dest: "-",
}))
assert.NilError(t, runExport(cli, "test", "-"))
assert.Equal(t, cli.ErrBuffer().String(), "")
cli.SetIn(streams.NewIn(io.NopCloser(bytes.NewBuffer(cli.OutBuffer().Bytes()))))
cli.OutBuffer().Reset()
cli.ErrBuffer().Reset()
assert.NilError(t, RunImport(cli, "test2", "-"))
assert.NilError(t, runImport(cli, "test2", "-"))
context1, err := cli.ContextStore().GetMetadata("test")
assert.NilError(t, err)
context2, err := cli.ContextStore().GetMetadata("test2")
@ -88,6 +82,6 @@ func TestExportExistingFile(t *testing.T) {
cli := makeFakeCli(t)
cli.ErrBuffer().Reset()
assert.NilError(t, os.WriteFile(contextFile, []byte{}, 0o644))
err := RunExport(cli, &ExportOptions{ContextName: "test", Dest: contextFile})
err := runExport(cli, "test", contextFile)
assert.Assert(t, os.IsExist(err))
}

View File

@ -13,6 +13,8 @@ import (
)
// ExportOptions are the options used for exporting a context
//
// Deprecated: this type was for internal use and will be removed in the next release.
type ExportOptions struct {
ContextName string
Dest string
@ -24,15 +26,14 @@ func newExportCommand(dockerCLI command.Cli) *cobra.Command {
Short: "Export a context to a tar archive FILE or a tar stream on STDOUT.",
Args: cli.RequiresRangeArgs(1, 2),
RunE: func(cmd *cobra.Command, args []string) error {
opts := &ExportOptions{
ContextName: args[0],
}
contextName := args[0]
var dest string
if len(args) == 2 {
opts.Dest = args[1]
dest = args[1]
} else {
opts.Dest = opts.ContextName + ".dockercontext"
dest = contextName + ".dockercontext"
}
return RunExport(dockerCLI, opts)
return runExport(dockerCLI, contextName, dest)
},
ValidArgsFunction: completeContextNames(dockerCLI, 1, true),
}
@ -65,11 +66,21 @@ func writeTo(dockerCli command.Cli, reader io.Reader, dest string) error {
}
// RunExport exports a Docker context
//
// Deprecated: this function was for internal use and will be removed in the next release.
func RunExport(dockerCli command.Cli, opts *ExportOptions) error {
if err := store.ValidateContextName(opts.ContextName); err != nil && opts.ContextName != command.DefaultContextName {
if opts == nil {
opts = &ExportOptions{}
}
return runExport(dockerCli, opts.ContextName, opts.Dest)
}
// runExport exports a Docker context.
func runExport(dockerCLI command.Cli, contextName string, dest string) error {
if err := store.ValidateContextName(contextName); err != nil && contextName != command.DefaultContextName {
return err
}
reader := store.Export(opts.ContextName, dockerCli.ContextStore())
reader := store.Export(contextName, dockerCLI.ContextStore())
defer reader.Close()
return writeTo(dockerCli, reader, opts.Dest)
return writeTo(dockerCLI, reader, dest)
}

View File

@ -18,7 +18,7 @@ func newImportCommand(dockerCli command.Cli) *cobra.Command {
Short: "Import a context from a tar or zip file",
Args: cli.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
return RunImport(dockerCli, args[0], args[1])
return runImport(dockerCli, args[0], args[1])
},
// TODO(thaJeztah): this should also include "-"
ValidArgsFunction: completion.FileNames,
@ -27,14 +27,21 @@ func newImportCommand(dockerCli command.Cli) *cobra.Command {
}
// RunImport imports a Docker context
func RunImport(dockerCli command.Cli, name string, source string) error {
if err := checkContextNameForCreation(dockerCli.ContextStore(), name); err != nil {
//
// Deprecated: this function was for internal use and will be removed in the next release.
func RunImport(dockerCLI command.Cli, name string, source string) error {
return runImport(dockerCLI, name, source)
}
// runImport imports a Docker context.
func runImport(dockerCLI command.Cli, name string, source string) error {
if err := checkContextNameForCreation(dockerCLI.ContextStore(), name); err != nil {
return err
}
var reader io.Reader
if source == "-" {
reader = dockerCli.In()
reader = dockerCLI.In()
} else {
f, err := os.Open(source)
if err != nil {
@ -44,11 +51,11 @@ func RunImport(dockerCli command.Cli, name string, source string) error {
reader = f
}
if err := store.Import(name, dockerCli.ContextStore(), reader); err != nil {
if err := store.Import(name, dockerCLI.ContextStore(), reader); err != nil {
return err
}
_, _ = fmt.Fprintln(dockerCli.Out(), name)
_, _ = fmt.Fprintf(dockerCli.Err(), "Successfully imported context %q\n", name)
_, _ = fmt.Fprintln(dockerCLI.Out(), name)
_, _ = fmt.Fprintf(dockerCLI.Err(), "Successfully imported context %q\n", name)
return nil
}

View File

@ -10,7 +10,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
"github.com/docker/cli/cli/context/docker"
flagsHelper "github.com/docker/cli/cli/flags"
@ -34,7 +33,7 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
return runList(dockerCli, opts)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -19,10 +19,10 @@ func createTestContexts(t *testing.T, cli command.Cli, name ...string) {
func createTestContext(t *testing.T, cli command.Cli, name string, metaData map[string]any) {
t.Helper()
err := RunCreate(cli, &CreateOptions{
Name: name,
Description: "description of " + name,
Docker: map[string]string{keyHost: "https://someswarmserver.example.com"},
err := runCreate(cli, &createOptions{
name: name,
description: "description of " + name,
endpoint: map[string]string{keyHost: "https://someswarmserver.example.com"},
metaData: metaData,
})

View File

@ -11,34 +11,48 @@ import (
)
// RemoveOptions are the options used to remove contexts
//
// Deprecated: this type was for internal use and will be removed in the next release.
type RemoveOptions struct {
Force bool
}
// removeOptions are the options used to remove contexts.
type removeOptions struct {
force bool
}
func newRemoveCommand(dockerCLI command.Cli) *cobra.Command {
var opts RemoveOptions
var opts removeOptions
cmd := &cobra.Command{
Use: "rm CONTEXT [CONTEXT...]",
Aliases: []string{"remove"},
Short: "Remove one or more contexts",
Args: cli.RequiresMinArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return RunRemove(dockerCLI, opts, args)
return runRemove(dockerCLI, opts, args)
},
ValidArgsFunction: completeContextNames(dockerCLI, -1, false),
}
cmd.Flags().BoolVarP(&opts.Force, "force", "f", false, "Force the removal of a context in use")
cmd.Flags().BoolVarP(&opts.force, "force", "f", false, "Force the removal of a context in use")
return cmd
}
// RunRemove removes one or more contexts
func RunRemove(dockerCLI command.Cli, opts RemoveOptions, names []string) error {
//
// Deprecated: this function was for internal use and will be removed in the next release.
func RunRemove(dockerCLI command.Cli, opts removeOptions, names []string) error {
return runRemove(dockerCLI, opts, names)
}
// runRemove removes one or more contexts.
func runRemove(dockerCLI command.Cli, opts removeOptions, names []string) error {
var errs []error
currentCtx := dockerCLI.CurrentContext()
for _, name := range names {
if name == "default" {
errs = append(errs, errors.New(`context "default" cannot be removed`))
} else if err := doRemove(dockerCLI, name, name == currentCtx, opts.Force); err != nil {
} else if err := doRemove(dockerCLI, name, name == currentCtx, opts.force); err != nil {
errs = append(errs, err)
} else {
_, _ = fmt.Fprintln(dockerCLI.Out(), name)

View File

@ -14,7 +14,7 @@ import (
func TestRemove(t *testing.T) {
cli := makeFakeCli(t)
createTestContexts(t, cli, "current", "other")
assert.NilError(t, RunRemove(cli, RemoveOptions{}, []string{"other"}))
assert.NilError(t, runRemove(cli, removeOptions{}, []string{"other"}))
_, err := cli.ContextStore().GetMetadata("current")
assert.NilError(t, err)
_, err = cli.ContextStore().GetMetadata("other")
@ -24,10 +24,10 @@ func TestRemove(t *testing.T) {
func TestRemoveNotAContext(t *testing.T) {
cli := makeFakeCli(t)
createTestContexts(t, cli, "current", "other")
err := RunRemove(cli, RemoveOptions{}, []string{"not-a-context"})
err := runRemove(cli, removeOptions{}, []string{"not-a-context"})
assert.ErrorContains(t, err, `context "not-a-context" does not exist`)
err = RunRemove(cli, RemoveOptions{Force: true}, []string{"not-a-context"})
err = runRemove(cli, removeOptions{force: true}, []string{"not-a-context"})
assert.NilError(t, err)
}
@ -35,7 +35,7 @@ func TestRemoveCurrent(t *testing.T) {
cli := makeFakeCli(t)
createTestContexts(t, cli, "current", "other")
cli.SetCurrentContext("current")
err := RunRemove(cli, RemoveOptions{}, []string{"current"})
err := runRemove(cli, removeOptions{}, []string{"current"})
assert.ErrorContains(t, err, `context "current" is in use, set -f flag to force remove`)
}
@ -49,7 +49,7 @@ func TestRemoveCurrentForce(t *testing.T) {
cli := makeFakeCli(t, withCliConfig(testCfg))
createTestContexts(t, cli, "current", "other")
cli.SetCurrentContext("current")
assert.NilError(t, RunRemove(cli, RemoveOptions{Force: true}, []string{"current"}))
assert.NilError(t, runRemove(cli, removeOptions{force: true}, []string{"current"}))
reloadedConfig, err := config.Load(configDir)
assert.NilError(t, err)
assert.Equal(t, "", reloadedConfig.CurrentContext)
@ -59,6 +59,6 @@ func TestRemoveDefault(t *testing.T) {
cli := makeFakeCli(t)
createTestContext(t, cli, "other", nil)
cli.SetCurrentContext("current")
err := RunRemove(cli, RemoveOptions{}, []string{"default"})
err := runRemove(cli, removeOptions{}, []string{"default"})
assert.ErrorContains(t, err, `context "default" cannot be removed`)
}

View File

@ -5,7 +5,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/spf13/cobra"
)
@ -19,7 +18,7 @@ func newShowCommand(dockerCli command.Cli) *cobra.Command {
runShow(dockerCli)
return nil
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
return cmd
}

View File

@ -13,12 +13,21 @@ import (
)
// UpdateOptions are the options used to update a context
//
// Deprecated: this type was for internal use and will be removed in the next release.
type UpdateOptions struct {
Name string
Description string
Docker map[string]string
}
// updateOptions are the options used to update a context.
type updateOptions struct {
name string
description string
endpoint map[string]string
}
func longUpdateDescription() string {
buf := bytes.NewBuffer(nil)
buf.WriteString("Update a context\n\nDocker endpoint config:\n\n")
@ -33,31 +42,45 @@ func longUpdateDescription() string {
}
func newUpdateCommand(dockerCLI command.Cli) *cobra.Command {
opts := &UpdateOptions{}
opts := updateOptions{}
cmd := &cobra.Command{
Use: "update [OPTIONS] CONTEXT",
Short: "Update a context",
Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
opts.Name = args[0]
return RunUpdate(dockerCLI, opts)
opts.name = args[0]
return runUpdate(dockerCLI, &opts)
},
Long: longUpdateDescription(),
ValidArgsFunction: completeContextNames(dockerCLI, 1, false),
}
flags := cmd.Flags()
flags.StringVar(&opts.Description, "description", "", "Description of the context")
flags.StringToStringVar(&opts.Docker, "docker", nil, "set the docker endpoint")
flags.StringVar(&opts.description, "description", "", "Description of the context")
flags.StringToStringVar(&opts.endpoint, "docker", nil, "set the docker endpoint")
return cmd
}
// RunUpdate updates a Docker context
//
// Deprecated: this function was for internal use and will be removed in the next release.
func RunUpdate(dockerCLI command.Cli, o *UpdateOptions) error {
if err := store.ValidateContextName(o.Name); err != nil {
if o == nil {
o = &UpdateOptions{}
}
return runUpdate(dockerCLI, &updateOptions{
name: o.Name,
description: o.Description,
endpoint: o.Docker,
})
}
// runUpdate updates a Docker context.
func runUpdate(dockerCLI command.Cli, opts *updateOptions) error {
if err := store.ValidateContextName(opts.name); err != nil {
return err
}
s := dockerCLI.ContextStore()
c, err := s.GetMetadata(o.Name)
c, err := s.GetMetadata(opts.name)
if err != nil {
return err
}
@ -65,16 +88,16 @@ func RunUpdate(dockerCLI command.Cli, o *UpdateOptions) error {
if err != nil {
return err
}
if o.Description != "" {
dockerContext.Description = o.Description
if opts.description != "" {
dockerContext.Description = opts.description
}
c.Metadata = dockerContext
tlsDataToReset := make(map[string]*store.EndpointTLSData)
if o.Docker != nil {
dockerEP, dockerTLS, err := getDockerEndpointMetadataAndTLS(s, o.Docker)
if opts.endpoint != nil {
dockerEP, dockerTLS, err := getDockerEndpointMetadataAndTLS(s, opts.endpoint)
if err != nil {
return fmt.Errorf("unable to create docker endpoint config: %w", err)
}
@ -88,13 +111,13 @@ func RunUpdate(dockerCLI command.Cli, o *UpdateOptions) error {
return err
}
for ep, tlsData := range tlsDataToReset {
if err := s.ResetEndpointTLSMaterial(o.Name, ep, tlsData); err != nil {
if err := s.ResetEndpointTLSMaterial(opts.name, ep, tlsData); err != nil {
return err
}
}
_, _ = fmt.Fprintln(dockerCLI.Out(), o.Name)
_, _ = fmt.Fprintf(dockerCLI.Err(), "Successfully updated context %q\n", o.Name)
_, _ = fmt.Fprintln(dockerCLI.Out(), opts.name)
_, _ = fmt.Fprintf(dockerCLI.Err(), "Successfully updated context %q\n", opts.name)
return nil
}

View File

@ -11,16 +11,16 @@ import (
func TestUpdateDescriptionOnly(t *testing.T) {
cli := makeFakeCli(t)
err := RunCreate(cli, &CreateOptions{
Name: "test",
Docker: map[string]string{},
err := runCreate(cli, &createOptions{
name: "test",
endpoint: map[string]string{},
})
assert.NilError(t, err)
cli.OutBuffer().Reset()
cli.ErrBuffer().Reset()
assert.NilError(t, RunUpdate(cli, &UpdateOptions{
Name: "test",
Description: "description",
assert.NilError(t, runUpdate(cli, &updateOptions{
name: "test",
description: "description",
}))
c, err := cli.ContextStore().GetMetadata("test")
assert.NilError(t, err)
@ -35,9 +35,9 @@ func TestUpdateDescriptionOnly(t *testing.T) {
func TestUpdateDockerOnly(t *testing.T) {
cli := makeFakeCli(t)
createTestContext(t, cli, "test", nil)
assert.NilError(t, RunUpdate(cli, &UpdateOptions{
Name: "test",
Docker: map[string]string{
assert.NilError(t, runUpdate(cli, &updateOptions{
name: "test",
endpoint: map[string]string{
keyHost: "tcp://some-host",
},
}))
@ -52,14 +52,14 @@ func TestUpdateDockerOnly(t *testing.T) {
func TestUpdateInvalidDockerHost(t *testing.T) {
cli := makeFakeCli(t)
err := RunCreate(cli, &CreateOptions{
Name: "test",
Docker: map[string]string{},
err := runCreate(cli, &createOptions{
name: "test",
endpoint: map[string]string{},
})
assert.NilError(t, err)
err = RunUpdate(cli, &UpdateOptions{
Name: "test",
Docker: map[string]string{
err = runUpdate(cli, &updateOptions{
name: "test",
endpoint: map[string]string{
keyHost: "some///invalid/host",
},
})

View File

@ -17,7 +17,7 @@ func newUseCommand(dockerCLI command.Cli) *cobra.Command {
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
name := args[0]
return RunUse(dockerCLI, name)
return runUse(dockerCLI, name)
},
ValidArgsFunction: completeContextNames(dockerCLI, 1, false),
}
@ -25,7 +25,14 @@ func newUseCommand(dockerCLI command.Cli) *cobra.Command {
}
// RunUse set the current Docker context
//
// Deprecated: this function was for internal use and will be removed in the next release.
func RunUse(dockerCLI command.Cli, name string) error {
return runUse(dockerCLI, name)
}
// runUse set the current Docker context
func runUse(dockerCLI command.Cli, name string) error {
// configValue uses an empty string for "default"
var configValue string
if name != command.DefaultContextName {

View File

@ -23,9 +23,9 @@ func TestUse(t *testing.T) {
configFilePath := filepath.Join(configDir, "config.json")
testCfg := configfile.New(configFilePath)
cli := makeFakeCli(t, withCliConfig(testCfg))
err := RunCreate(cli, &CreateOptions{
Name: "test",
Docker: map[string]string{},
err := runCreate(cli, &createOptions{
name: "test",
endpoint: map[string]string{},
})
assert.NilError(t, err)
assert.NilError(t, newUseCommand(cli).RunE(nil, []string{"test"}))
@ -89,9 +89,9 @@ func TestUseHostOverride(t *testing.T) {
configFilePath := filepath.Join(configDir, "config.json")
testCfg := configfile.New(configFilePath)
cli := makeFakeCli(t, withCliConfig(testCfg))
err := RunCreate(cli, &CreateOptions{
Name: "test",
Docker: map[string]string{},
err := runCreate(cli, &createOptions{
name: "test",
endpoint: map[string]string{},
})
assert.NilError(t, err)
@ -136,9 +136,9 @@ func TestUseHostOverrideEmpty(t *testing.T) {
assert.NilError(t, cli.Initialize(flags.NewClientOptions()))
}
loadCli()
err := RunCreate(cli, &CreateOptions{
Name: "test",
Docker: map[string]string{"host": socketPath},
err := runCreate(cli, &createOptions{
name: "test",
endpoint: map[string]string{"host": socketPath},
})
assert.NilError(t, err)

View File

@ -42,7 +42,7 @@ func newLoadCommand(dockerCLI command.Cli) *cobra.Command {
Annotations: map[string]string{
"aliases": "docker image load, docker load",
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -8,7 +8,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/internal/prompt"
"github.com/docker/cli/opts"
"github.com/docker/go-units"
@ -49,7 +48,7 @@ func newPruneCommand(dockerCLI command.Cli) *cobra.Command {
return nil
},
Annotations: map[string]string{"version": "1.25"},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -46,7 +46,7 @@ func newPullCommand(dockerCLI command.Cli) *cobra.Command {
"category-top": "5",
"aliases": "docker image pull, docker pull",
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -10,7 +10,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/client"
@ -69,7 +68,7 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
return runCreate(cmd.Context(), dockerCLI.Client(), dockerCLI.Out(), options)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -6,7 +6,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
flagsHelper "github.com/docker/cli/cli/flags"
"github.com/docker/cli/opts"
@ -33,7 +32,7 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
return runList(cmd.Context(), dockerCli, options)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -6,7 +6,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
flagsHelper "github.com/docker/cli/cli/flags"
"github.com/docker/cli/opts"
@ -34,7 +33,7 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
return runList(cmd.Context(), dockerCli, options)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()
flags.BoolVarP(&options.quiet, "quiet", "q", false, "Only display IDs")
@ -45,7 +44,7 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
// Set a default completion function if none was set. We don't look
// up if it does already have one set, because Cobra does this for
// us, and returns an error (which we ignore for this reason).
_ = cmd.RegisterFlagCompletionFunc(flag.Name, completion.NoComplete)
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
})
return cmd
}

View File

@ -6,7 +6,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/idresolver"
"github.com/docker/cli/cli/command/task"
"github.com/docker/cli/opts"
@ -54,7 +53,7 @@ func newPsCommand(dockerCli command.Cli) *cobra.Command {
// Set a default completion function if none was set. We don't look
// up if it does already have one set, because Cobra does this for
// us, and returns an error (which we ignore for this reason).
_ = cmd.RegisterFlagCompletionFunc(flag.Name, completion.NoComplete)
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
})
return cmd
}

View File

@ -43,7 +43,7 @@ func newUpdateCommand(dockerCli command.Cli) *cobra.Command {
// Set a default completion function if none was set. We don't look
// up if it does already have one set, because Cobra does this for
// us, and returns an error (which we ignore for this reason).
_ = cmd.RegisterFlagCompletionFunc(flag.Name, completion.NoComplete)
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
})
return cmd
}

View File

@ -10,7 +10,6 @@ import (
"github.com/distribution/reference"
"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/moby/go-archive"
"github.com/moby/go-archive/compression"
@ -76,7 +75,7 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command {
options.context = args[1]
return runCreate(cmd.Context(), dockerCli, options)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -6,7 +6,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
flagsHelper "github.com/docker/cli/cli/flags"
"github.com/docker/cli/opts"
@ -32,7 +31,7 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
return runList(cmd.Context(), dockerCli, options)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -11,7 +11,6 @@ import (
"github.com/containerd/errdefs"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/config/configfile"
configtypes "github.com/docker/cli/cli/config/types"
"github.com/docker/cli/internal/oauth/manager"
@ -59,7 +58,7 @@ func newLoginCommand(dockerCLI command.Cli) *cobra.Command {
Annotations: map[string]string{
"category-top": "8",
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()
@ -185,10 +184,15 @@ func loginWithStoredCredentials(ctx context.Context, dockerCLI command.Cli, auth
return response.Status, err
}
// OauthLoginEscapeHatchEnvVar disables the browser-based OAuth login workflow.
//
// Deprecated: this const was only used internally and will be removed in the next release.
const OauthLoginEscapeHatchEnvVar = "DOCKER_CLI_DISABLE_OAUTH_LOGIN"
const oauthLoginEscapeHatchEnvVar = "DOCKER_CLI_DISABLE_OAUTH_LOGIN"
func isOauthLoginDisabled() bool {
if v := os.Getenv(OauthLoginEscapeHatchEnvVar); v != "" {
if v := os.Getenv(oauthLoginEscapeHatchEnvVar); v != "" {
enabled, err := strconv.ParseBool(v)
if err != nil {
return false

View File

@ -533,7 +533,7 @@ func TestIsOauthLoginDisabled(t *testing.T) {
}
for _, tc := range testCases {
t.Setenv(OauthLoginEscapeHatchEnvVar, tc.envVar)
t.Setenv(oauthLoginEscapeHatchEnvVar, tc.envVar)
disabled := isOauthLoginDisabled()

View File

@ -29,7 +29,7 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
}
return runCreate(cmd.Context(), dockerCLI, cmd.Flags(), opts)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()
flags.StringVar(&opts.mode, flagMode, "replicated", `Service mode ("replicated", "global", "replicated-job", "global-job")`)
@ -94,7 +94,7 @@ func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
// Set a default completion function if none was set. We don't look
// up if it does already have one set, because Cobra does this for
// us, and returns an error (which we ignore for this reason).
_ = cmd.RegisterFlagCompletionFunc(flag.Name, completion.NoComplete)
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
})
return cmd
}

View File

@ -10,7 +10,6 @@ import (
"github.com/containerd/errdefs"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
flagsHelper "github.com/docker/cli/cli/flags"
"github.com/docker/docker/api/types/network"
@ -52,7 +51,7 @@ func newInspectCommand(dockerCli command.Cli) *cobra.Command {
// Set a default completion function if none was set. We don't look
// up if it does already have one set, because Cobra does this for
// us, and returns an error (which we ignore for this reason).
_ = cmd.RegisterFlagCompletionFunc(flag.Name, completion.NoComplete)
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
})
return cmd
}

View File

@ -5,7 +5,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
flagsHelper "github.com/docker/cli/cli/flags"
"github.com/docker/cli/opts"
@ -33,7 +32,7 @@ func newListCommand(dockerCLI command.Cli) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
return runList(cmd.Context(), dockerCLI, options)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()
@ -45,7 +44,7 @@ func newListCommand(dockerCLI command.Cli) *cobra.Command {
// Set a default completion function if none was set. We don't look
// up if it does already have one set, because Cobra does this for
// us, and returns an error (which we ignore for this reason).
_ = cmd.RegisterFlagCompletionFunc(flag.Name, completion.NoComplete)
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
})
return cmd
}

View File

@ -12,7 +12,6 @@ import (
"github.com/containerd/errdefs"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
"github.com/docker/cli/cli/command/idresolver"
"github.com/docker/cli/internal/logdetails"
@ -73,7 +72,7 @@ func newLogsCommand(dockerCli command.Cli) *cobra.Command {
// Set a default completion function if none was set. We don't look
// up if it does already have one set, because Cobra does this for
// us, and returns an error (which we ignore for this reason).
_ = cmd.RegisterFlagCompletionFunc(flag.Name, completion.NoComplete)
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
})
return cmd
}

View File

@ -6,7 +6,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/idresolver"
"github.com/docker/cli/cli/command/node"
"github.com/docker/cli/cli/command/task"
@ -52,7 +51,7 @@ func newPsCommand(dockerCli command.Cli) *cobra.Command {
// Set a default completion function if none was set. We don't look
// up if it does already have one set, because Cobra does this for
// us, and returns an error (which we ignore for this reason).
_ = cmd.RegisterFlagCompletionFunc(flag.Name, completion.NoComplete)
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
})
return cmd
}

View File

@ -6,7 +6,6 @@ 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/swarm"
"github.com/docker/docker/api/types/versions"
"github.com/spf13/cobra"
@ -35,7 +34,7 @@ func newRollbackCommand(dockerCli command.Cli) *cobra.Command {
// Set a default completion function if none was set. We don't look
// up if it does already have one set, because Cobra does this for
// us, and returns an error (which we ignore for this reason).
_ = cmd.RegisterFlagCompletionFunc(flag.Name, completion.NoComplete)
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
})
return cmd
}

View File

@ -137,7 +137,7 @@ func newUpdateCommand(dockerCLI command.Cli) *cobra.Command {
// Set a default completion function if none was set. We don't look
// up if it does already have one set, because Cobra does this for
// us, and returns an error (which we ignore for this reason).
_ = cmd.RegisterFlagCompletionFunc(flag.Name, completion.NoComplete)
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
})
return cmd

View File

@ -6,7 +6,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/stack/loader"
"github.com/docker/cli/cli/command/stack/options"
composeLoader "github.com/docker/cli/cli/compose/loader"
@ -36,7 +35,7 @@ func newConfigCommand(dockerCli command.Cli) *cobra.Command {
_, err = fmt.Fprintf(dockerCli.Out(), "%s", cfg)
return err
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -7,7 +7,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/stack/formatter"
"github.com/docker/cli/cli/command/stack/options"
"github.com/docker/cli/cli/command/stack/swarm"
@ -29,7 +28,7 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
return runList(cmd.Context(), dockerCli, opts)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -8,7 +8,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/swarm/progress"
"github.com/docker/cli/internal/jsonstream"
"github.com/docker/docker/api/types/swarm"
@ -40,7 +39,7 @@ func newCACommand(dockerCli command.Cli) *cobra.Command {
"version": "1.30",
"swarm": "manager",
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -8,7 +8,6 @@ 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/swarm"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@ -44,7 +43,7 @@ func newInitCommand(dockerCli command.Cli) *cobra.Command {
"version": "1.24",
"swarm": "", // swarm init does not require swarm to be active, and is always available on API 1.24 and up
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -6,7 +6,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/spf13/cobra"
)
@ -28,7 +27,7 @@ func newLeaveCommand(dockerCli command.Cli) *cobra.Command {
"version": "1.24",
"swarm": "active",
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -9,7 +9,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/streams"
"github.com/docker/docker/api/types/swarm"
"github.com/pkg/errors"
@ -29,7 +28,7 @@ func newUnlockCommand(dockerCli command.Cli) *cobra.Command {
"version": "1.24",
"swarm": "manager",
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
return cmd

View File

@ -7,7 +7,6 @@ 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/swarm"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@ -32,7 +31,7 @@ func newUnlockKeyCommand(dockerCli command.Cli) *cobra.Command {
"version": "1.24",
"swarm": "manager",
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -6,7 +6,6 @@ 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/swarm"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@ -33,7 +32,7 @@ func newUpdateCommand(dockerCli command.Cli) *cobra.Command {
"version": "1.24",
"swarm": "manager",
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
cmd.Flags().BoolVar(&opts.autolock, flagAutolock, false, "Change manager autolocking setting (true|false)")

View File

@ -5,7 +5,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
flagsHelper "github.com/docker/cli/cli/flags"
"github.com/docker/docker/api/types"
@ -29,7 +28,7 @@ func newDiskUsageCommand(dockerCli command.Cli) *cobra.Command {
return runDiskUsage(cmd.Context(), dockerCli, opts)
},
Annotations: map[string]string{"version": "1.25"},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -7,7 +7,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
@ -23,7 +22,7 @@ func newDialStdioCommand(dockerCli command.Cli) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
return runDialStdio(cmd.Context(), dockerCli)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
return cmd
}

View File

@ -11,7 +11,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
flagsHelper "github.com/docker/cli/cli/flags"
"github.com/docker/cli/opts"
@ -48,7 +47,7 @@ func newEventsCommand(dockerCLI command.Cli) *cobra.Command {
Annotations: map[string]string{
"aliases": "docker system events, docker events",
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -14,7 +14,6 @@ import (
"github.com/docker/cli/cli"
pluginmanager "github.com/docker/cli/cli-plugins/manager"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
"github.com/docker/cli/cli/debug"
flagsHelper "github.com/docker/cli/cli/flags"
@ -81,7 +80,7 @@ func newInfoCommand(dockerCLI command.Cli) *cobra.Command {
"category-top": "12",
"aliases": "docker system info, docker info",
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
cmd.Flags().StringVarP(&opts.format, "format", "f", "", flagsHelper.InspectFormatHelp)

View File

@ -82,7 +82,7 @@ func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
return runInspect(cmd.Context(), dockerCLI, opts)
},
// TODO(thaJeztah): should we consider adding completion for common object-types? (images, containers?)
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()
@ -95,7 +95,7 @@ func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
// Set a default completion function if none was set. We don't look
// up if it does already have one set, because Cobra does this for
// us, and returns an error (which we ignore for this reason).
_ = cmd.RegisterFlagCompletionFunc(flag.Name, completion.NoComplete)
_ = cmd.RegisterFlagCompletionFunc(flag.Name, cobra.NoFileCompletions)
})
return cmd
}

View File

@ -10,7 +10,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/builder"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/container"
"github.com/docker/cli/cli/command/image"
"github.com/docker/cli/cli/command/network"
@ -45,7 +44,7 @@ func newPruneCommand(dockerCli command.Cli) *cobra.Command {
return runPrune(cmd.Context(), dockerCli, options)
},
Annotations: map[string]string{"version": "1.25"},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -10,7 +10,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
"github.com/docker/cli/cli/command/formatter/tabwriter"
flagsHelper "github.com/docker/cli/cli/flags"
@ -129,7 +128,7 @@ func newVersionCommand(dockerCLI command.Cli) *cobra.Command {
Annotations: map[string]string{
"category-top": "10",
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
cmd.Flags().StringVarP(&opts.format, "format", "f", "", flagsHelper.InspectFormatHelp)

View File

@ -9,7 +9,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types/volume"
"github.com/spf13/cobra"
@ -59,7 +58,7 @@ func newCreateCommand(dockerCli command.Cli) *cobra.Command {
options.cluster = hasClusterVolumeOptionSet(cmd.Flags())
return runCreate(cmd.Context(), dockerCli, options)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()
flags.StringVarP(&options.driver, "driver", "d", "local", "Specify volume driver name")

View File

@ -6,7 +6,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/cli/command/formatter"
flagsHelper "github.com/docker/cli/cli/flags"
"github.com/docker/cli/opts"
@ -37,7 +36,7 @@ func newListCommand(dockerCli command.Cli) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
return runList(cmd.Context(), dockerCli, options)
},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -7,7 +7,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/completion"
"github.com/docker/cli/internal/prompt"
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types/versions"
@ -48,7 +47,7 @@ func newPruneCommand(dockerCLI command.Cli) *cobra.Command {
return nil
},
Annotations: map[string]string{"version": "1.25"},
ValidArgsFunction: completion.NoComplete,
ValidArgsFunction: cobra.NoFileCompletions,
}
flags := cmd.Flags()

View File

@ -16,7 +16,7 @@ require (
github.com/distribution/reference v0.6.0
github.com/docker/cli-docs-tool v0.10.0
github.com/docker/distribution v2.8.3+incompatible
github.com/docker/docker v28.3.4-0.20250828134822-02b4a1a3decc+incompatible // 28.x branch (v28.4.0-dev)
github.com/docker/docker v28.4.0-rc.1.0.20250902095642-5d5332b00c76+incompatible // 28.x branch (v28.4.0-dev)
github.com/docker/docker-credential-helpers v0.9.3
github.com/docker/go-connections v0.5.0
github.com/docker/go-units v0.5.0

View File

@ -57,8 +57,8 @@ github.com/docker/cli-docs-tool v0.10.0/go.mod h1:5EM5zPnT2E7yCLERZmrDA234Vwn09f
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 v28.3.4-0.20250828134822-02b4a1a3decc+incompatible h1:a4+xSvQFFYl8eRsVWyL3lwz1JubDEO77m1ovj3lFiXo=
github.com/docker/docker v28.3.4-0.20250828134822-02b4a1a3decc+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v28.4.0-rc.1.0.20250902095642-5d5332b00c76+incompatible h1:tl2qgu+4b/D7S63nPqQa4234kklUdz8EhAxJ5RPYBlE=
github.com/docker/docker v28.4.0-rc.1.0.20250902095642-5d5332b00c76+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker-credential-helpers v0.9.3 h1:gAm/VtF9wgqJMoxzT3Gj5p4AqIjCBS4wrsOh9yRqcz8=
github.com/docker/docker-credential-helpers v0.9.3/go.mod h1:x+4Gbw9aGmChi3qTLZj8Dfn0TD20M/fuWy0E5+WDeCo=
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0=

View File

@ -1608,6 +1608,8 @@ definitions:
Bridge:
description: |
Name of the default bridge interface when dockerd's --bridge flag is set.
Deprecated: This field is only set when the daemon is started with the --bridge flag specified.
type: "string"
example: "docker0"
SandboxID:

View File

@ -13,8 +13,11 @@ type NetworkSettings struct {
}
// NetworkSettingsBase holds networking state for a container when inspecting it.
//
// Deprecated: Most fields in NetworkSettingsBase are deprecated. Fields which aren't deprecated will move to
// NetworkSettings in v29.0, and this struct will be removed.
type NetworkSettingsBase struct {
Bridge string // Bridge contains the name of the default bridge interface iff it was set through the daemon --bridge flag.
Bridge string // Deprecated: This field is only set when the daemon is started with the --bridge flag specified.
SandboxID string // SandboxID uniquely represents a container's network stack
SandboxKey string // SandboxKey identifies the sandbox
Ports nat.PortMap // Ports is a collection of PortBinding indexed by Port
@ -35,18 +38,44 @@ type NetworkSettingsBase struct {
SecondaryIPv6Addresses []network.Address // Deprecated: This field is never set and will be removed in a future release.
}
// DefaultNetworkSettings holds network information
// during the 2 release deprecation period.
// It will be removed in Docker 1.11.
// DefaultNetworkSettings holds the networking state for the default bridge, if the container is connected to that
// network.
//
// Deprecated: this struct is deprecated since Docker v1.11 and will be removed in v29. You should look for the default
// network in NetworkSettings.Networks instead.
type DefaultNetworkSettings struct {
EndpointID string // EndpointID uniquely represents a service endpoint in a Sandbox
Gateway string // Gateway holds the gateway address for the network
GlobalIPv6Address string // GlobalIPv6Address holds network's global IPv6 address
GlobalIPv6PrefixLen int // GlobalIPv6PrefixLen represents mask length of network's global IPv6 address
IPAddress string // IPAddress holds the IPv4 address for the network
IPPrefixLen int // IPPrefixLen represents mask length of network's IPv4 address
IPv6Gateway string // IPv6Gateway holds gateway address specific for IPv6
MacAddress string // MacAddress holds the MAC address for the network
// EndpointID uniquely represents a service endpoint in a Sandbox
//
// Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
EndpointID string
// Gateway holds the gateway address for the network
//
// Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
Gateway string
// GlobalIPv6Address holds network's global IPv6 address
//
// Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
GlobalIPv6Address string
// GlobalIPv6PrefixLen represents mask length of network's global IPv6 address
//
// Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
GlobalIPv6PrefixLen int
// IPAddress holds the IPv4 address for the network
//
// Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
IPAddress string
// IPPrefixLen represents mask length of network's IPv4 address
//
// Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
IPPrefixLen int
// IPv6Gateway holds gateway address specific for IPv6
//
// Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
IPv6Gateway string
// MacAddress holds the MAC address for the network
//
// Deprecated: This field will be removed in v29. You should look for the default network in NetworkSettings.Networks instead.
MacAddress string
}
// NetworkSettingsSummary provides a summary of container's networks

View File

@ -46,15 +46,16 @@ type NetworkSettings = container.NetworkSettings
// NetworkSettingsBase holds networking state for a container when inspecting it.
//
// Deprecated: use [container.NetworkSettingsBase].
type NetworkSettingsBase = container.NetworkSettingsBase
// Deprecated: [container.NetworkSettingsBase] will be removed in v29. Prefer
// accessing the fields it contains through [container.NetworkSettings].
type NetworkSettingsBase = container.NetworkSettingsBase //nolint:staticcheck // ignore SA1019: NetworkSettingsBase is deprecated in v28.4.
// DefaultNetworkSettings holds network information
// during the 2 release deprecation period.
// It will be removed in Docker 1.11.
//
// Deprecated: use [container.DefaultNetworkSettings].
type DefaultNetworkSettings = container.DefaultNetworkSettings
type DefaultNetworkSettings = container.DefaultNetworkSettings //nolint:staticcheck // ignore SA1019: DefaultNetworkSettings is deprecated in v28.4.
// SummaryNetworkSettings provides a summary of container's networks
// in /containers/json.

2
vendor/modules.txt vendored
View File

@ -65,7 +65,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 v28.3.4-0.20250828134822-02b4a1a3decc+incompatible
# github.com/docker/docker v28.4.0-rc.1.0.20250902095642-5d5332b00c76+incompatible
## explicit
github.com/docker/docker/api
github.com/docker/docker/api/types