MCPcopy Create free account
hub / github.com/docker/cli / newLogoutCommand

Function newLogoutCommand

cli/command/registry/logout.go:21–42  ·  view source on GitHub ↗

newLogoutCommand creates a new `docker logout` command

(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

19
20// newLogoutCommand creates a new `docker logout` command
21func newLogoutCommand(dockerCLI command.Cli) *cobra.Command {
22 cmd := &cobra.Command{
23 Use: "logout [SERVER]",
24 Short: "Log out from a registry",
25 Long: "Log out from a registry.\nIf no server is specified, the default is defined by the daemon.",
26 Args: cli.RequiresMaxArgs(1),
27 RunE: func(cmd *cobra.Command, args []string) error {
28 var serverAddress string
29 if len(args) > 0 {
30 serverAddress = args[0]
31 }
32 return runLogout(cmd.Context(), dockerCLI, serverAddress)
33 },
34 Annotations: map[string]string{
35 "category-top": "9",
36 },
37 DisableFlagsInUseLine: true,
38 // TODO (thaJeztah) add completion for registries we have authentication stored for
39 }
40
41 return cmd
42}
43
44func runLogout(ctx context.Context, dockerCLI command.Cli, serverAddress string) error {
45 maybePrintEnvAuthWarning(dockerCLI)

Callers

nothing calls this directly

Calls 1

runLogoutFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…