Documentation ¶
Index ¶
- Constants
- Variables
- func AddPlatformFlag(flags *pflag.FlagSet, target *string)
- func AddTrustSigningFlags(fs *pflag.FlagSet, v *bool, trusted bool)
- func AddTrustVerificationFlags(fs *pflag.FlagSet, v *bool, trusted bool)
- func BuildKitEnabled(si ServerInfo) (bool, error)
- func ConfigureAuth(cli Cli, flUser, flPassword string, authconfig *types.AuthConfig, ...) error
- func CopyToFile(outfile string, r io.Reader) error
- func ElectAuthServer(ctx context.Context, cli Cli) string
- func EncodeAuthToBase64(authConfig types.AuthConfig) (string, error)
- func GetDefaultAuthConfig(cli Cli, checkCredStore bool, serverAddress string, isDefaultRegistry bool) (*types.AuthConfig, error)
- func NewAPIClientFromFlags(opts *cliflags.CommonOptions, configFile *configfile.ConfigFile) (client.APIClient, error)
- func PrettyPrint(i interface{}) string
- func PromptForConfirmation(ins io.Reader, outs io.Writer, message string) bool
- func PruneFilters(dockerCli Cli, pruneFilters filters.Args) filters.Args
- func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInfo, cmdName string) types.RequestPrivilegeFunc
- func ResolveAuthConfig(ctx context.Context, cli Cli, index *registrytypes.IndexInfo) types.AuthConfig
- func RetrieveAuthTokenFromImage(ctx context.Context, cli Cli, image string) (string, error)
- func ShowHelp(err io.Writer) func(*cobra.Command, []string) error
- func UserAgent() string
- type Cli
- type ClientInfo
- type DockerCli
- func (cli *DockerCli) Apply(ops ...DockerCliOption) error
- func (cli *DockerCli) Client() client.APIClient
- func (cli *DockerCli) ClientInfo() ClientInfo
- func (cli *DockerCli) ConfigFile() *configfile.ConfigFile
- func (cli *DockerCli) ContentTrustEnabled() bool
- func (cli *DockerCli) ContextStore() store.Store
- func (cli *DockerCli) CurrentContext() string
- func (cli *DockerCli) DefaultVersion() string
- func (cli *DockerCli) DockerEndpoint() docker.Endpoint
- func (cli *DockerCli) Err() io.Writer
- func (cli *DockerCli) In() *streams.In
- func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions) error
- func (cli *DockerCli) ManifestStore() manifeststore.Store
- func (cli *DockerCli) NewContainerizedEngineClient(sockPath string) (clitypes.ContainerizedClient, error)
- func (cli *DockerCli) NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error)
- func (cli *DockerCli) Out() *streams.Out
- func (cli *DockerCli) RegistryClient(allowInsecure bool) registryclient.RegistryClient
- func (cli *DockerCli) ServerInfo() ServerInfo
- func (cli *DockerCli) SetIn(in *streams.In)
- func (cli *DockerCli) StackOrchestrator(flagValue string) (Orchestrator, error)
- type DockerCliOption
- func WithCombinedStreams(combined io.Writer) DockerCliOption
- func WithContainerizedClient(containerizedFn func(string) (clitypes.ContainerizedClient, error)) DockerCliOption
- func WithContentTrust(enabled bool) DockerCliOption
- func WithContentTrustFromEnv() DockerCliOption
- func WithContextEndpointType(endpointName string, endpointType store.TypeGetter) DockerCliOption
- func WithErrorStream(err io.Writer) DockerCliOption
- func WithInputStream(in io.ReadCloser) DockerCliOption
- func WithOutputStream(out io.Writer) DockerCliOption
- func WithStandardStreams() DockerCliOption
- type DockerContext
- type EventHandler
- type InStream
- type Orchestrator
- type OutStream
- type ServerInfo
- type Streams
Constants ¶
const ( // OrchestratorKubernetes orchestrator OrchestratorKubernetes = Orchestrator("kubernetes") // OrchestratorSwarm orchestrator OrchestratorSwarm = Orchestrator("swarm") // OrchestratorAll orchestrator OrchestratorAll = Orchestrator("all") )
Variables ¶
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 ¶
AddPlatformFlag adds `platform` to a set of flags for API version 1.32 and later.
func AddTrustSigningFlags ¶
AddTrustSigningFlags adds "signing" flags to the provided flagset
func AddTrustVerificationFlags ¶
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 ¶
CopyToFile writes the content of the reader to the specified file
func ElectAuthServer ¶
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 ¶
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 PruneFilters ¶
PruneFilters returns consolidated prune filters obtained from config.json and cli
func RegistryAuthenticationPrivilegedFunc ¶
func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInfo, cmdName string) types.RequestPrivilegeFunc
RegistryAuthenticationPrivilegedFunc returns a RequestPrivilegeFunc from the specified registry index info for the given command.
func ResolveAuthConfig ¶
func ResolveAuthConfig(ctx context.Context, cli Cli, index *registrytypes.IndexInfo) types.AuthConfig
ResolveAuthConfig is like registry.ResolveAuthConfig, but if using the default index, it uses the default index name for the daemon's platform, not the client's platform.
func RetrieveAuthTokenFromImage ¶
RetrieveAuthTokenFromImage retrieves an encoded auth token given a complete image
Types ¶
type Cli ¶
type Cli interface { Client() client.APIClient Out() *streams.Out Err() io.Writer In() *streams.In SetIn(in *streams.In) Apply(ops ...DockerCliOption) error ConfigFile() *configfile.ConfigFile ServerInfo() ServerInfo ClientInfo() ClientInfo NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error) DefaultVersion() string ManifestStore() manifeststore.Store RegistryClient(bool) registryclient.RegistryClient ContentTrustEnabled() bool NewContainerizedEngineClient(sockPath string) (clitypes.ContainerizedClient, error) ContextStore() store.Store CurrentContext() string StackOrchestrator(flagValue string) (Orchestrator, error) DockerEndpoint() docker.Endpoint }
Cli represents the docker command line client.
type ClientInfo ¶
ClientInfo stores details about the supported features of the client
type DockerCli ¶
type DockerCli struct {
// contains filtered or unexported fields
}
DockerCli is an instance the docker command line client. Instances of the client can be returned from NewDockerCli.
func NewDockerCli ¶
func NewDockerCli(ops ...DockerCliOption) (*DockerCli, error)
NewDockerCli returns a DockerCli instance with all operators applied on it. It applies by default the standard streams, the content trust from environment and the default containerized client constructor operations.
func (*DockerCli) Apply ¶
func (cli *DockerCli) Apply(ops ...DockerCliOption) error
Apply all the operation on the cli
func (*DockerCli) ClientInfo ¶
func (cli *DockerCli) ClientInfo() ClientInfo
ClientInfo returns the client details for the cli
func (*DockerCli) ConfigFile ¶
func (cli *DockerCli) ConfigFile() *configfile.ConfigFile
ConfigFile returns the ConfigFile
func (*DockerCli) ContentTrustEnabled ¶
ContentTrustEnabled returns whether content trust has been enabled by an environment variable.
func (*DockerCli) ContextStore ¶
ContextStore returns the ContextStore
func (*DockerCli) CurrentContext ¶
CurrentContext returns the current context name
func (*DockerCli) DefaultVersion ¶
DefaultVersion returns api.defaultVersion or DOCKER_API_VERSION if specified.
func (*DockerCli) DockerEndpoint ¶
DockerEndpoint returns the current docker endpoint
func (*DockerCli) Initialize ¶
func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions) error
Initialize the dockerCli runs initialization that must happen after command line flags are parsed.
func (*DockerCli) ManifestStore ¶
func (cli *DockerCli) ManifestStore() manifeststore.Store
ManifestStore returns a store for local manifests
func (*DockerCli) NewContainerizedEngineClient ¶
func (cli *DockerCli) NewContainerizedEngineClient(sockPath string) (clitypes.ContainerizedClient, error)
NewContainerizedEngineClient returns a containerized engine client
func (*DockerCli) NotaryClient ¶
func (cli *DockerCli) NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error)
NotaryClient provides a Notary Repository to interact with signed metadata for an image
func (*DockerCli) RegistryClient ¶
func (cli *DockerCli) RegistryClient(allowInsecure bool) registryclient.RegistryClient
RegistryClient returns a client for communicating with a Docker distribution registry
func (*DockerCli) ServerInfo ¶
func (cli *DockerCli) ServerInfo() ServerInfo
ServerInfo returns the server version details for the host this client is connected to
func (*DockerCli) StackOrchestrator ¶
func (cli *DockerCli) StackOrchestrator(flagValue string) (Orchestrator, error)
StackOrchestrator resolves which stack orchestrator is in use
type DockerCliOption ¶
DockerCliOption applies a modification on a DockerCli.
func WithCombinedStreams ¶
func WithCombinedStreams(combined io.Writer) DockerCliOption
WithCombinedStreams uses the same stream for the output and error streams.
func WithContainerizedClient ¶
func WithContainerizedClient(containerizedFn func(string) (clitypes.ContainerizedClient, error)) DockerCliOption
WithContainerizedClient sets the containerized client constructor on a cli.
func WithContentTrust ¶
func WithContentTrust(enabled bool) DockerCliOption
WithContentTrust enables content trust on a cli.
func WithContentTrustFromEnv ¶
func WithContentTrustFromEnv() DockerCliOption
WithContentTrustFromEnv enables content trust on a cli from environment variable DOCKER_CONTENT_TRUST value.
func WithContextEndpointType ¶
func WithContextEndpointType(endpointName string, endpointType store.TypeGetter) DockerCliOption
WithContextEndpointType add support for an additional typed endpoint in the context store Plugins should use this to store additional endpoints configuration in the context store
func WithErrorStream ¶
func WithErrorStream(err io.Writer) DockerCliOption
WithErrorStream sets a cli error stream.
func WithInputStream ¶
func WithInputStream(in io.ReadCloser) DockerCliOption
WithInputStream sets a cli input stream.
func WithOutputStream ¶
func WithOutputStream(out io.Writer) DockerCliOption
WithOutputStream sets a cli output stream.
func WithStandardStreams ¶
func WithStandardStreams() DockerCliOption
WithStandardStreams sets a cli in, out and err streams with the standard streams.
type DockerContext ¶
type DockerContext struct { Description string `json:",omitempty"` StackOrchestrator Orchestrator `json:",omitempty"` }
DockerContext is a typed representation of what we put in Context metadata
func GetDockerContext ¶
func GetDockerContext(storeMetadata store.ContextMetadata) (DockerContext, error)
GetDockerContext extracts metadata from stored context metadata
type EventHandler ¶
type EventHandler interface { Handle(action string, h func(eventtypes.Message)) Watch(c <-chan eventtypes.Message) }
EventHandler is abstract interface for user to customize own handle functions of each type of events
func InitEventHandler ¶
func InitEventHandler() EventHandler
InitEventHandler initializes and returns an EventHandler
type InStream ¶
InStream is an input stream used by the DockerCli to read user input Deprecated: Use github.com/docker/cli/cli/streams.In instead
type Orchestrator ¶
type Orchestrator string
Orchestrator type acts as an enum describing supported orchestrators.
func GetStackOrchestrator ¶
func GetStackOrchestrator(flagValue, contextValue, globalDefault string, stderr io.Writer) (Orchestrator, error)
GetStackOrchestrator checks DOCKER_STACK_ORCHESTRATOR environment variable and configuration file orchestrator value and returns user defined Orchestrator.
func NormalizeOrchestrator ¶
func NormalizeOrchestrator(value string) (Orchestrator, error)
NormalizeOrchestrator parses an orchestrator value and checks if it is valid
func (Orchestrator) HasAll ¶
func (o Orchestrator) HasAll() bool
HasAll returns true if defined orchestrator has both Swarm and Kubernetes capabilities.
func (Orchestrator) HasKubernetes ¶
func (o Orchestrator) HasKubernetes() bool
HasKubernetes returns true if defined orchestrator has Kubernetes capabilities.
func (Orchestrator) HasSwarm ¶
func (o Orchestrator) HasSwarm() bool
HasSwarm returns true if defined orchestrator has Swarm capabilities.
type OutStream ¶
OutStream is an output stream used by the DockerCli to write normal program output. Deprecated: Use github.com/docker/cli/cli/streams.Out instead
type ServerInfo ¶
type ServerInfo struct { HasExperimental bool OSType string BuildkitVersion types.BuilderVersion }
ServerInfo stores details about the supported features and platform of the server