Documentation ¶
Overview ¶
Package client provides a command-line interface for Docker.
Run "docker help SUBCOMMAND" or "docker SUBCOMMAND --help" to see more information on any Docker subcommand, including the full list of options supported for the subcommand. See https://docs.docker.com/installation/ for instructions on installing Docker.
Index ¶
- func AddTrustedFlags(fs *pflag.FlagSet, verify bool)
- func CopyToFile(outfile string, r io.Reader) error
- func EncodeAuthToBase64(authConfig types.AuthConfig) (string, error)
- func IsTrusted() bool
- func LoadDefaultConfigFile(err io.Writer) *configfile.ConfigFile
- func NewAPIClientFromFlags(clientFlags *cliflags.ClientFlags, configFile *configfile.ConfigFile) (client.APIClient, error)
- func ParseExec(cmd *flag.FlagSet, args []string) (*types.ExecConfig, error)
- type DockerCli
- func (cli *DockerCli) CheckTtyInput(attachStdin, ttyMode bool) error
- func (cli *DockerCli) Client() client.APIClient
- func (cli *DockerCli) CmdCommit(args ...string) error
- func (cli *DockerCli) CmdCp(args ...string) error
- func (cli *DockerCli) CmdExec(args ...string) error
- func (cli *DockerCli) CmdInfo(args ...string) error
- func (cli *DockerCli) CmdInspect(args ...string) error
- func (cli *DockerCli) CmdLoad(args ...string) error
- func (cli *DockerCli) CmdLogin(args ...string) error
- func (cli *DockerCli) CmdLogout(args ...string) error
- func (cli *DockerCli) CmdPs(args ...string) error
- func (cli *DockerCli) CmdPull(args ...string) error
- func (cli *DockerCli) CmdPush(args ...string) error
- func (cli *DockerCli) CmdSave(args ...string) error
- func (cli *DockerCli) CmdUpdate(args ...string) error
- func (cli *DockerCli) Command(name string) func(...string) error
- func (cli *DockerCli) ConfigFile() *configfile.ConfigFile
- func (cli *DockerCli) Err() io.Writer
- func (cli *DockerCli) ForwardAllSignals(ctx context.Context, cid string) chan os.Signal
- func (cli *DockerCli) GetExitCode(ctx context.Context, containerID string) (bool, int, error)
- func (cli *DockerCli) GetTtySize() (int, int)
- func (cli *DockerCli) HoldHijackedConnection(ctx context.Context, tty bool, inputStream io.ReadCloser, ...) error
- func (cli *DockerCli) ImagesFormat() string
- func (cli *DockerCli) In() io.ReadCloser
- func (cli *DockerCli) Initialize() error
- func (cli *DockerCli) IsTerminalOut() bool
- func (cli *DockerCli) MonitorTtySize(ctx context.Context, id string, isExec bool) error
- func (cli *DockerCli) Out() io.Writer
- func (cli *DockerCli) OutFd() uintptr
- func (cli *DockerCli) PsFormat() string
- func (cli *DockerCli) RegistryAuthenticationPrivilegedFunc(index *registrytypes.IndexInfo, cmdName string) types.RequestPrivilegeFunc
- func (cli *DockerCli) ResizeTtyTo(ctx context.Context, id string, height, width int, isExec bool)
- func (cli *DockerCli) ResolveAuthConfig(ctx context.Context, index *registrytypes.IndexInfo) types.AuthConfig
- func (cli *DockerCli) RetrieveAuthConfigs() map[string]types.AuthConfig
- func (cli *DockerCli) TagTrusted(ctx context.Context, trustedRef reference.Canonical, ref reference.NamedTagged) error
- func (cli *DockerCli) TrustedReference(ctx context.Context, ref reference.NamedTagged) (reference.Canonical, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTrustedFlags ¶
AddTrustedFlags adds the trust flags to a FlagSet
func CopyToFile ¶
CopyToFile writes the content of the reader to the specified file
func EncodeAuthToBase64 ¶
func EncodeAuthToBase64(authConfig types.AuthConfig) (string, error)
EncodeAuthToBase64 serializes the auth configuration as JSON base64 payload
func LoadDefaultConfigFile ¶
func LoadDefaultConfigFile(err io.Writer) *configfile.ConfigFile
LoadDefaultConfigFile attempts to load the default config file and returns an initialized ConfigFile struct if none is found.
func NewAPIClientFromFlags ¶
func NewAPIClientFromFlags(clientFlags *cliflags.ClientFlags, configFile *configfile.ConfigFile) (client.APIClient, error)
NewAPIClientFromFlags creates a new APIClient from command line flags
Types ¶
type DockerCli ¶
type DockerCli struct {
// contains filtered or unexported fields
}
DockerCli represents 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, clientFlags *cliflags.ClientFlags) *DockerCli
NewDockerCli returns a DockerCli instance with IO output and error streams set by in, out and err. The key file, protocol (i.e. unix) and address are passed in as strings, along with the tls.Config. If the tls.Config is set the client scheme will be set to https. The client will be given a 32-second timeout (see https://github.com/docker/docker/pull/8035).
func (*DockerCli) CheckTtyInput ¶
CheckTtyInput 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 (*DockerCli) CmdCommit ¶
CmdCommit creates a new image from a container's changes.
Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
func (*DockerCli) CmdCp ¶
CmdCp copies files/folders to or from a path in a container.
When copying from a container, if DEST_PATH is '-' the data is written as a tar archive file to STDOUT.
When copying to a container, if SRC_PATH is '-' the data is read as a tar archive file from STDIN, and the destination CONTAINER:DEST_PATH, must specify a directory.
Usage:
docker cp CONTAINER:SRC_PATH DEST_PATH|- docker cp SRC_PATH|- CONTAINER:DEST_PATH
func (*DockerCli) CmdExec ¶
CmdExec runs a command in a running container.
Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
func (*DockerCli) CmdInspect ¶
CmdInspect displays low-level information on one or more containers or images.
Usage: docker inspect [OPTIONS] CONTAINER|IMAGE [CONTAINER|IMAGE...]
func (*DockerCli) CmdLoad ¶
CmdLoad loads an image from a tar archive.
The tar archive is read from STDIN by default, or from a tar archive file.
Usage: docker load [OPTIONS]
func (*DockerCli) CmdLogin ¶
CmdLogin logs in a user to a Docker registry service.
If no server is specified, the user will be logged into or registered to the registry's index server.
Usage: docker login SERVER
func (*DockerCli) CmdLogout ¶
CmdLogout logs a user out from a Docker registry.
If no server is specified, the user will be logged out from the registry's index server.
Usage: docker logout [SERVER]
func (*DockerCli) CmdPull ¶
CmdPull pulls an image or a repository from the registry.
Usage: docker pull [OPTIONS] IMAGENAME[:TAG|@DIGEST]
func (*DockerCli) CmdPush ¶
CmdPush pushes an image or repository to the registry.
Usage: docker push NAME[:TAG]
func (*DockerCli) CmdSave ¶
CmdSave saves one or more images to a tar archive.
The tar archive is written to STDOUT by default, or written to a file.
Usage: docker save [OPTIONS] IMAGE [IMAGE...]
func (*DockerCli) CmdUpdate ¶
CmdUpdate updates resources of one or more containers.
Usage: docker update [OPTIONS] CONTAINER [CONTAINER...]
func (*DockerCli) ConfigFile ¶
func (cli *DockerCli) ConfigFile() *configfile.ConfigFile
ConfigFile returns the ConfigFile
func (*DockerCli) ForwardAllSignals ¶
ForwardAllSignals forwards signals to the container TODO: this can be unexported again once all container commands are under api/client/container
func (*DockerCli) GetExitCode ¶
GetExitCode perform an inspect on the container. It returns the running state and the exit code.
func (*DockerCli) GetTtySize ¶
GetTtySize returns the height and width in characters of the tty
func (*DockerCli) HoldHijackedConnection ¶
func (cli *DockerCli) HoldHijackedConnection(ctx context.Context, tty bool, inputStream io.ReadCloser, outputStream, errorStream io.Writer, resp types.HijackedResponse) error
HoldHijackedConnection handles copying input to and output from streams to the connection
func (*DockerCli) ImagesFormat ¶
ImagesFormat returns the format string specified in the configuration. String contains columns and format specification, for example {{ID}}\t{{Name}}.
func (*DockerCli) In ¶
func (cli *DockerCli) In() io.ReadCloser
In returns the reader used for stdin
func (*DockerCli) Initialize ¶
Initialize calls the init function that will setup the configuration for the client such as the TLS, tcp and other parameters used to run the client.
func (*DockerCli) IsTerminalOut ¶
IsTerminalOut returns true if the clients stdin is a TTY
func (*DockerCli) MonitorTtySize ¶
MonitorTtySize updates the container tty size when the terminal tty changes size
func (*DockerCli) PsFormat ¶
PsFormat returns the format string specified in the configuration. String contains columns and format specification, for example {{ID}}\t{{Name}}.
func (*DockerCli) RegistryAuthenticationPrivilegedFunc ¶
func (cli *DockerCli) RegistryAuthenticationPrivilegedFunc(index *registrytypes.IndexInfo, cmdName string) types.RequestPrivilegeFunc
RegistryAuthenticationPrivilegedFunc return a RequestPrivilegeFunc from the specified registry index info for the given command.
func (*DockerCli) ResizeTtyTo ¶
ResizeTtyTo resizes tty to specific height and width TODO: this can be unexported again once all container related commands move to package container
func (*DockerCli) ResolveAuthConfig ¶
func (cli *DockerCli) ResolveAuthConfig(ctx context.Context, 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 (*DockerCli) RetrieveAuthConfigs ¶
func (cli *DockerCli) RetrieveAuthConfigs() map[string]types.AuthConfig
RetrieveAuthConfigs return all credentials.
func (*DockerCli) TagTrusted ¶
func (cli *DockerCli) TagTrusted(ctx context.Context, trustedRef reference.Canonical, ref reference.NamedTagged) error
TagTrusted tags a trusted ref
func (*DockerCli) TrustedReference ¶
func (cli *DockerCli) TrustedReference(ctx context.Context, ref reference.NamedTagged) (reference.Canonical, error)
TrustedReference returns the canonical trusted reference for an image reference