command

package
v0.0.0-...-814ced4 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2018 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OrchestratorKubernetes orchestrator
	OrchestratorKubernetes = Orchestrator("kubernetes")
	// OrchestratorSwarm orchestrator
	OrchestratorSwarm = Orchestrator("swarm")
	// OrchestratorAll orchestrator
	OrchestratorAll = Orchestrator("all")
)

Variables

This section is empty.

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 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 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 PruneFilters

func PruneFilters(dockerCli Cli, pruneFilters filters.Args) filters.Args

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

func RetrieveAuthTokenFromImage(ctx context.Context, cli Cli, image string) (string, error)

RetrieveAuthTokenFromImage retrieves an encoded auth token given a complete image

func ShowHelp

func ShowHelp(err io.Writer) func(*cobra.Command, []string) error

ShowHelp shows the command help.

func UserAgent

func UserAgent() string

UserAgent returns the user agent string used for making API requests

Types

type Cli

type Cli interface {
	Client() client.APIClient
	Out() *OutStream
	Err() io.Writer
	In() *InStream
	SetIn(in *InStream)
	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)
}

Cli represents the docker command line client.

type ClientInfo

type ClientInfo struct {
	HasExperimental bool
	DefaultVersion  string
}

ClientInfo stores details about the supported features of the client

type CommonStream

type CommonStream struct {
	// contains filtered or unexported fields
}

CommonStream is an input stream used by the DockerCli to read user input

func (*CommonStream) FD

func (s *CommonStream) FD() uintptr

FD returns the file descriptor number for this stream

func (*CommonStream) IsTerminal

func (s *CommonStream) IsTerminal() bool

IsTerminal returns true if this stream is connected to a terminal

func (*CommonStream) RestoreTerminal

func (s *CommonStream) RestoreTerminal()

RestoreTerminal restores normal mode to the terminal

func (*CommonStream) SetIsTerminal

func (s *CommonStream) SetIsTerminal(isTerminal bool)

SetIsTerminal sets the boolean used for isTerminal

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(in io.ReadCloser, out, err io.Writer, isTrusted bool, containerizedFn func(string) (clitypes.ContainerizedClient, error)) *DockerCli

NewDockerCli returns a DockerCli instance with IO output and error streams set by in, out and err.

func (*DockerCli) Client

func (cli *DockerCli) Client() client.APIClient

Client returns the APIClient

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

func (cli *DockerCli) ContentTrustEnabled() bool

ContentTrustEnabled returns whether content trust has been enabled by an environment variable.

func (*DockerCli) DefaultVersion

func (cli *DockerCli) DefaultVersion() string

DefaultVersion returns api.defaultVersion or DOCKER_API_VERSION if specified.

func (*DockerCli) Err

func (cli *DockerCli) Err() io.Writer

Err returns the writer used for stderr

func (*DockerCli) In

func (cli *DockerCli) In() *InStream

In returns the reader used for stdin

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) Out

func (cli *DockerCli) Out() *OutStream

Out returns the writer used for stdout

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) SetIn

func (cli *DockerCli) SetIn(in *InStream)

SetIn sets the reader used for stdin

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

type InStream struct {
	CommonStream
	// contains filtered or unexported fields
}

InStream is an input stream used by the DockerCli to read user input

func NewInStream

func NewInStream(in io.ReadCloser) *InStream

NewInStream returns a new InStream object from a ReadCloser

func (*InStream) CheckTty

func (i *InStream) CheckTty(attachStdin, ttyMode bool) error

CheckTty checks if we are trying to attach to a container tty from a non-tty client input stream, and if so, returns an error.

func (*InStream) Close

func (i *InStream) Close() error

Close implements the Closer interface

func (*InStream) Read

func (i *InStream) Read(p []byte) (int, error)

func (*InStream) SetRawTerminal

func (i *InStream) SetRawTerminal() (err error)

SetRawTerminal sets raw mode on the input terminal

type Orchestrator

type Orchestrator string

Orchestrator type acts as an enum describing supported orchestrators.

func GetStackOrchestrator

func GetStackOrchestrator(flagValue, value string, stderr io.Writer) (Orchestrator, error)

GetStackOrchestrator checks DOCKER_STACK_ORCHESTRATOR environment variable and configuration file orchestrator value and returns user defined Orchestrator.

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

type OutStream struct {
	CommonStream
	// contains filtered or unexported fields
}

OutStream is an output stream used by the DockerCli to write normal program output.

func NewOutStream

func NewOutStream(out io.Writer) *OutStream

NewOutStream returns a new OutStream object from a Writer

func (*OutStream) GetTtySize

func (o *OutStream) GetTtySize() (uint, uint)

GetTtySize returns the height and width in characters of the tty

func (*OutStream) SetRawTerminal

func (o *OutStream) SetRawTerminal() (err error)

SetRawTerminal sets raw mode on the input terminal

func (*OutStream) Write

func (o *OutStream) Write(p []byte) (int, error)

type ServerInfo

type ServerInfo struct {
	HasExperimental bool
	OSType          string
	BuildkitVersion types.BuilderVersion
}

ServerInfo stores details about the supported features and platform of the server

type Streams

type Streams interface {
	In() *InStream
	Out() *OutStream
	Err() io.Writer
}

Streams is an interface which exposes the standard input and output streams

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL