Documentation ¶
Index ¶
- Constants
- func DeleteImage(imageID string) error
- func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, ...) error
- func DisplayJSONMessagesToStream(in io.Reader, stream stream, auxCallback func(JSONMessage)) error
- func EnsureNetworkMode(networkMode, driver string) (created bool, err error)
- func ForwardAllSignals(ctx context.Context, client *client.Client, streams Streams, cid string) chan os.Signal
- func GetDockerVersion() (string, error)
- func MonitorTtySize(ctx context.Context, streams Streams, id string, isExec bool) error
- func NewStreams(in io.ReadCloser, out io.Writer, err io.Writer) *streams
- func PromiseGo(f func() error) chan error
- func StdCopy(ctx context.Context, dstOut, dstErr io.Writer, src io.Reader) (written int64, err error)
- type ConditionWriter
- type Container
- func (c *Container) AddPort(portName, hostIP string, hostPort int)
- func (c *Container) Attach(ctx context.Context, tty bool, streams Streams, stdin io.ReadCloser, ...) (close func(), errAttach error)
- func (c *Container) BuildImage(name string, credentials map[string]*Credential, ...) error
- func (c *Container) EnsureContainer(attachStdin, attachStdout, attachStderr bool, consoleSize [2]uint) error
- func (c *Container) EnsureContainerRunning(attachStdin, attachStdout, attachStderr bool, consoleSize [2]uint) error
- func (c *Container) EnsureID() (string, error)
- func (c *Container) EnsureImage(name string, ref *string, out io.Writer) (string, error)
- func (c *Container) EnsureImageByID(id string) error
- func (c *Container) Exists() (bool, error)
- func (c *Container) GetImageID() (string, error)
- func (c Container) ID() *string
- func (c *Container) IsRunning() (bool, error)
- func (c Container) Name() string
- func (c *Container) Purge() error
- func (c Container) QualifiedName() string
- func (c *Container) Rename(newName string) error
- func (c *Container) SetArgs(args []string) *Container
- func (c *Container) SetAuthConfig(host, userName, password string) *Container
- func (c *Container) SetEnv(env map[string]string) *Container
- func (c *Container) SetMounts(mounts map[string]string) *Container
- func (c *Container) SetNetwork(networkMode *string) *Container
- func (c *Container) StopAndRename(newName string) error
- func (c *Container) WaitExitOrRemoved(ctx context.Context, detach context.CancelFunc, writerExitChan ExitChan) (exitChan ExitChan, err error)
- type Credential
- type ExitChan
- type InStream
- type JSONError
- type JSONMessage
- type JSONProgress
- type OutStream
- type StdType
- type Streams
Constants ¶
const ( ExitCodeTimeout = 90408 ExitMaxWriteLines = 90509 ExitStopKeyword = 90510 )
const RFC3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00"
RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to ensure the formatted time isalways the same number of characters.
Variables ¶
This section is empty.
Functions ¶
func DeleteImage ¶
func DisplayJSONMessagesStream ¶
func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error
DisplayJSONMessagesStream displays a json message stream from `in` to `out`, `isTerminal` describes if `out` is a terminal. If this is the case, it will print `\n` at the end of each line and move the cursor while displaying.
func DisplayJSONMessagesToStream ¶
func DisplayJSONMessagesToStream(in io.Reader, stream stream, auxCallback func(JSONMessage)) error
DisplayJSONMessagesToStream prints json messages to the output stream
func EnsureNetworkMode ¶
func ForwardAllSignals ¶
func ForwardAllSignals(ctx context.Context, client *client.Client, streams Streams, cid string) chan os.Signal
ForwardAllSignals forwards signals to the container
func GetDockerVersion ¶
func MonitorTtySize ¶
MonitorTtySize updates the container tty size when the terminal tty changes size
func NewStreams ¶
func StdCopy ¶
func StdCopy(ctx context.Context, dstOut, dstErr io.Writer, src io.Reader) (written int64, err error)
StdCopy is a modified version of io.Copy.
StdCopy will demultiplex `src`, assuming that it contains two streams, previously multiplexed together using a StdWriter instance. As it reads from `src`, StdCopy will write to `dstout` and `dsterr`.
StdCopy will read until it hits EOF on `src`. It will then return a nil error. In other words: if `err` is non nil, it indicates a real underlying error.
`written` will hold the total number of bytes written to `dstout` and `dsterr`.
Types ¶
type ConditionWriter ¶
type ConditionWriter struct {
// contains filtered or unexported fields
}
func CreateConditionWriter ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func NewContainer ¶
func (*Container) BuildImage ¶
func (*Container) EnsureContainer ¶
func (*Container) EnsureContainerRunning ¶
func (*Container) EnsureImage ¶
func (*Container) EnsureImageByID ¶
func (*Container) GetImageID ¶
func (Container) QualifiedName ¶
func (*Container) SetAuthConfig ¶
func (*Container) SetNetwork ¶
func (*Container) StopAndRename ¶
func (*Container) WaitExitOrRemoved ¶
type Credential ¶
type InStream ¶
type InStream struct {
// 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 ¶
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) IsTerminal ¶
IsTerminal returns true if this stream is connected to a terminal
func (*InStream) RestoreTerminal ¶
func (i *InStream) RestoreTerminal()
RestoreTerminal restores normal mode to the terminal
func (*InStream) SetRawTerminal ¶
SetRawTerminal sets raw mode on the input terminal
type JSONError ¶
type JSONError struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` }
JSONError wraps a concrete Code and Message, `Code` is is an integer error code, `Message` is the error message.
type JSONMessage ¶
type JSONMessage struct { Stream string `json:"stream,omitempty"` Status string `json:"status,omitempty"` Progress *JSONProgress `json:"progressDetail,omitempty"` ProgressMessage string `json:"progress,omitempty"` // deprecated ID string `json:"id,omitempty"` From string `json:"from,omitempty"` Time int64 `json:"time,omitempty"` TimeNano int64 `json:"timeNano,omitempty"` Error *JSONError `json:"errorDetail,omitempty"` ErrorMessage string `json:"error,omitempty"` // deprecated // Aux contains out-of-band data, such as digests for push signing and image id after building. Aux *json.RawMessage `json:"aux,omitempty"` }
JSONMessage defines a message struct. It describes the created time, where it from, status, ID of the message. It's used for docker events.
type JSONProgress ¶
type JSONProgress struct { Current int64 `json:"current,omitempty"` Total int64 `json:"total,omitempty"` Start int64 `json:"start,omitempty"` // If true, don't show xB/yB HideCounts bool `json:"hidecounts,omitempty"` Units string `json:"units,omitempty"` // contains filtered or unexported fields }
JSONProgress describes a Progress. terminalFd is the fd of the current terminal, Start is the initial value for the operation. Current is the current status and value of the progress made towards Total. Total is the end value describing when we made 100% progress for an operation.
func (*JSONProgress) String ¶
func (p *JSONProgress) String() string
type OutStream ¶
type OutStream struct {
// contains filtered or unexported fields
}
OutStream is an output stream used by the DockerCli to write normal program output.
func NewOutStream ¶
NewOutStream returns a new OutStream object from a Writer
func (*OutStream) GetTtySize ¶
GetTtySize returns the height and width in characters of the tty
func (*OutStream) IsTerminal ¶
IsTerminal returns true if this stream is connected to a terminal
func (*OutStream) RestoreTerminal ¶
func (o *OutStream) RestoreTerminal()
RestoreTerminal restores normal mode to the terminal
func (*OutStream) SetRawTerminal ¶
SetRawTerminal sets raw mode on the output terminal
type StdType ¶
type StdType byte
StdType is the type of standard stream a writer can multiplex to.
const ( // Stdin represents standard input stream type. Stdin StdType = iota // Stdout represents standard output stream type. Stdout // Stderr represents standard error steam type. Stderr // SystemErr represents errors originating from the system that make it // into the the multiplexed stream. SystemErr )