command

package
v20.10.18+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 47 Imported by: 4,906

Documentation

Index

Constants

View Source
const (
	// OrchestratorKubernetes orchestrator
	OrchestratorKubernetes = Orchestrator("kubernetes")
	// OrchestratorSwarm orchestrator
	OrchestratorSwarm = Orchestrator("swarm")
	// OrchestratorAll orchestrator
	OrchestratorAll = Orchestrator("all")
)
View Source
const (
	// DefaultContextName is the name reserved for the default context (config & env based)
	DefaultContextName = "default"
)

Variables

View Source
var (
	// NewInStream returns a new InStream object from a ReadCloser
	// Deprecated: Use github.com/docker/cli/cli/streams.NewIn instead
	NewInStream = streams.NewIn
	// NewOutStream returns a new OutStream object from a Writer
	// Deprecated: Use github.com/docker/cli/cli/streams.NewOut instead
	NewOutStream = streams.NewOut
)

Functions

func AddPlatformFlag

func AddPlatformFlag(flags *pflag.FlagSet, target *string)

AddPlatformFlag adds `platform` to a set of flags for API version 1.32 and later.

func AddTrustSigningFlags

func AddTrustSigningFlags(fs *pflag.FlagSet, v *bool, trusted bool)

AddTrustSigningFlags adds "signing" flags to the provided flagset

func AddTrustVerificationFlags

func AddTrustVerificationFlags(fs *pflag.FlagSet, v *bool, trusted bool)

AddTrustVerificationFlags adds content trust flags to the provided flagset

func BuildKitEnabled

func BuildKitEnabled(si ServerInfo) (bool, error)

BuildKitEnabled returns whether buildkit is enabled either through a daemon setting or otherwise the client-side DOCKER_BUILDKIT environment variable

func ConfigureAuth

func ConfigureAuth(cli Cli, flUser, flPassword string, authconfig *types.AuthConfig, isDefaultRegistry bool) error

ConfigureAuth handles prompting of user's username and password if needed

func CopyToFile

func CopyToFile(outfile string, r io.Reader) error

CopyToFile writes the content of the reader to the specified file

func DefaultContextStoreConfig

func DefaultContextStoreConfig() store.Config

DefaultContextStoreConfig returns a new store.Config with the default set of endpoints configured.

func ElectAuthServer

func ElectAuthServer(ctx context.Context, cli Cli) string

ElectAuthServer returns the default registry to use (by asking the daemon)

func EncodeAuthToBase64

func EncodeAuthToBase64(authConfig types.AuthConfig) (string, error)

EncodeAuthToBase64 serializes the auth configuration as JSON base64 payload

func GetDefaultAuthConfig

func GetDefaultAuthConfig(cli Cli, checkCredStore bool, serverAddress string, isDefaultRegistry bool) (types.AuthConfig, error)

GetDefaultAuthConfig gets the default auth config given a serverAddress If credentials for given serverAddress exists in the credential store, the configuration will be populated with values in it

func NewAPIClientFromFlags

func NewAPIClientFromFlags(opts *cliflags.CommonOptions, configFile *configfile.ConfigFile) (client.APIClient, error)

NewAPIClientFromFlags creates a new APIClient from command line flags

func PrettyPrint

func PrettyPrint(i interface{}) string

PrettyPrint outputs arbitrary data for human formatted output by uppercasing the first letter.

func PromptForConfirmation

func PromptForConfirmation(ins io.Reader, outs io.Writer, message string) bool

PromptForConfirmation requests and checks confirmation from user. This will display the provided message followed by ' y/N '. If the user input 'y' or 'Y' it returns true other false. If no message is provided "Are you sure you want to proceed? y/N " will be used instead.

func