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 BaseCommandAttributes(cmd *cobra.Command, streams Streams) []attribute.KeyValue
- func ConfigureAuth(ctx context.Context, cli Cli, flUser, flPassword string, ...) errordeprecated
- func CopyToFile(outfile string, r io.Reader) error
- func DefaultContextStoreConfig() store.Config
- func DisableInputEcho(ins *streams.In) (restore func() error, err error)
- func GetDefaultAuthConfig(cfg *configfile.ConfigFile, checkCredStore bool, serverAddress string, ...) (registrytypes.AuthConfig, error)
- func NewAPIClientFromFlags(opts *cliflags.ClientOptions, configFile *configfile.ConfigFile) (client.APIClient, error)
- func PrettyPrint(i any) string
- func PromptForConfirmation(ctx context.Context, ins io.Reader, outs io.Writer, message string) (bool, error)
- func PromptForInput(ctx context.Context, in io.Reader, out io.Writer, message string) (string, error)
- func PromptUserForCredentials(ctx context.Context, cli Cli, ...) (registrytypes.AuthConfig, error)
- func PruneFilters(dockerCli Cli, pruneFilters filters.Args) filters.Args
- func RegisterDefaultStoreEndpoints(ep ...store.NamedTypeGetter)
- func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInfo, cmdName string) registrytypes.RequestAuthConfig
- func ResolveAuthConfig(cfg *configfile.ConfigFile, index *registrytypes.IndexInfo) registrytypes.AuthConfig
- func RetrieveAuthTokenFromImage(cfg *configfile.ConfigFile, image string) (string, error)
- func ShowHelp(err io.Writer) func(*cobra.Command, []string) error
- func StringSliceReplaceAt(s, find, replace []string, requireIndex int) ([]string, bool)
- func UserAgent() string
- func ValidateMountWithAPIVersion(m mounttypes.Mount, serverAPIVersion string) error
- func ValidateOutputPath(path string) error
- func ValidateOutputPathFileMode(fileMode os.FileMode) error
- type CLIOption
- func WithAPIClient(c client.APIClient) CLIOption
- func WithBaseContext(ctx context.Context) CLIOption
- func WithCombinedStreams(combined io.Writer) CLIOption
- func WithContentTrust(enabled bool) CLIOption
- func WithContentTrustFromEnv() CLIOption
- func WithDefaultContextStoreConfig() CLIOption
- func WithEnableGlobalMeterProvider() CLIOption
- func WithEnableGlobalTracerProvider() CLIOption
- func WithErrorStream(err io.Writer) CLIOption
- func WithInitializeClient(makeClient func(dockerCli *DockerCli) (client.APIClient, error)) CLIOption
- func WithInputStream(in io.ReadCloser) CLIOption
- func WithOutputStream(out io.Writer) CLIOption
- func WithResource(res *resource.Resource) CLIOption
- func WithResourceOptions(opts ...resource.Option) CLIOption
- func WithStandardStreams() CLIOption
- type Cli
- type ContextStoreWithDefault
- func (s *ContextStoreWithDefault) CreateOrUpdate(meta store.Metadata) error
- func (s *ContextStoreWithDefault) GetMetadata(name string) (store.Metadata, error)
- func (s *ContextStoreWithDefault) GetStorageInfo(contextName string) store.StorageInfo
- func (s *ContextStoreWithDefault) GetTLSData(contextName, endpointName, fileName string) ([]byte, error)
- func (s *ContextStoreWithDefault) List() ([]store.Metadata, error)
- func (s *ContextStoreWithDefault) ListTLSFiles(name string) (map[string]store.EndpointFiles, error)
- func (s *ContextStoreWithDefault) Remove(name string) error
- func (s *ContextStoreWithDefault) ResetEndpointTLSMaterial(contextName string, endpointName string, data *store.EndpointTLSData) error
- func (s *ContextStoreWithDefault) ResetTLSMaterial(name string, data *store.ContextTLSData) error
- type DefaultContext
- type DefaultContextResolver
- type DockerCli
- func (cli *DockerCli) Apply(ops ...CLIOption) error
- func (cli *DockerCli) BuildKitEnabled() (bool, error)
- func (cli *DockerCli) Client() client.APIClient
- 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) CurrentVersion() string
- func (cli *DockerCli) DefaultVersion() string
- func (cli *DockerCli) DockerEndpoint() docker.Endpoint
- func (cli *DockerCli) Err() *streams.Out
- func (cli *DockerCli) HooksEnabled() bool
- func (cli *DockerCli) In() *streams.In
- func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions, ops ...CLIOption) error
- func (cli *DockerCli) InstrumentCobraCommands(ctx context.Context, cmd *cobra.Command)
- func (cli *DockerCli) ManifestStore() manifeststore.Store
- func (cli *DockerCli) MeterProvider() metric.MeterProvider
- 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) Resource() *resource.Resource
- func (cli *DockerCli) ServerInfo() ServerInfo
- func (cli *DockerCli) SetIn(in *streams.In)
- func (cli *DockerCli) StartInstrumentation(cmd *cobra.Command) (stopInstrumentation func(error))
- func (cli *DockerCli) TracerProvider() trace.TracerProvider
- type DockerContext
- type EndpointDefaultResolver
- type MeterProvider
- type ServerInfo
- type Streams
- type TelemetryClient
- type TracerProvider
Constants ¶
const ( // DefaultContextName is the name reserved for the default context (config & env based) DefaultContextName = "default" // EnvOverrideContext is the name of the environment variable that can be // used to override the context to use. If set, it overrides the context // that's set in the CLI's configuration file, but takes no effect if the // "DOCKER_HOST" env-var is set (which takes precedence. EnvOverrideContext = "DOCKER_CONTEXT" )
Variables ¶
var ErrPromptTerminated = errdefs.Cancelled(errors.New("prompt terminated"))
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 BaseCommandAttributes ¶
BaseCommandAttributes returns an attribute.Set containing attributes to attach to metrics/traces
func ConfigureAuth
deprecated
func ConfigureAuth(ctx context.Context, cli Cli, flUser, flPassword string, authConfig *registrytypes.AuthConfig, _ bool) error
ConfigureAuth handles prompting of user's username and password if needed.
Deprecated: use PromptUserForCredentials instead.
func CopyToFile ¶
CopyToFile writes the content of the reader to the specified file
func DefaultContextStoreConfig ¶
DefaultContextStoreConfig returns a new store.Config with the default set of endpoints configured.
func DisableInputEcho ¶
DisableInputEcho disables input echo on the provided streams.In. This is useful when the user provides sensitive information like passwords. The function returns a restore function that should be called to restore the terminal state.
func GetDefaultAuthConfig ¶
func GetDefaultAuthConfig(cfg *configfile.ConfigFile, checkCredStore bool, serverAddress string, isDefaultRegistry bool) (registrytypes.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.ClientOptions, configFile *configfile.ConfigFile) (client.APIClient, error)
NewAPIClientFromFlags creates a new APIClient from command line flags
func PrettyPrint ¶
PrettyPrint outputs arbitrary data for human formatted output by uppercasing the first letter.
func PromptForConfirmation ¶
func PromptForConfirmation(ctx context.Context, ins io.Reader, outs io.Writer, message string) (bool, error)
PromptForConfirmation requests and checks confirmation from the user. This will display the provided message followed by ' y/N '. If the user input 'y' or 'Y' it returns true otherwise false. If no message is provided, "Are you sure you want to proceed? y/N " will be used instead.
If the user terminates the CLI with SIGINT or SIGTERM while the prompt is active, the prompt will return false with an ErrPromptTerminated error. When the prompt returns an error, the caller should propagate the error up the stack and close the io.Reader used for the prompt which will prevent the background goroutine from blocking indefinitely.
func PromptForInput ¶
func PromptForInput(ctx context.Context, in io.Reader, out io.Writer, message string) (string, error)
PromptForInput requests input from the user.
If the user terminates the CLI with SIGINT or SIGTERM while the prompt is active, the prompt will return an empty string ("") with an ErrPromptTerminated error. When the prompt returns an error, the caller should propagate the error up the stack and close the io.Reader used for the prompt which will prevent the background goroutine from blocking indefinitely.
func PromptUserForCredentials ¶
func PromptUserForCredentials(ctx context.Context, cli Cli, argUser, argPassword, defaultUsername, serverAddress string) (registrytypes.AuthConfig, error)
PromptUserForCredentials handles the CLI prompt for the user to input credentials. If argUser is not empty, then the user is only prompted for their password. If argPassword is not empty, then the user is only prompted for their username If neither argUser nor argPassword are empty, then the user is not prompted and an AuthConfig is returned with those values. If defaultUsername is not empty, the username prompt includes that username and the user can hit enter without inputting a username to use that default username.
func PruneFilters ¶
PruneFilters returns consolidated prune filters obtained from config.json and cli