Documentation
¶
Overview ¶
Package dockerclient wraps the Docker Engine SDK for wrongtop: one call to list containers with live stats, lifecycle actions and log streaming. A missing daemon is not fatal — callers surface a notice.
Index ¶
- func CopyLogStream(w io.Writer, r io.Reader, tty bool) error
- type Client
- func (c *Client) Close() error
- func (c *Client) List(ctx context.Context) ([]Container, error)
- func (c *Client) Logs(ctx context.Context, id string, follow bool) (io.ReadCloser, bool, error)
- func (c *Client) Restart(ctx context.Context, id string) error
- func (c *Client) Start(ctx context.Context, id string) error
- func (c *Client) Stop(ctx context.Context, id string) error
- type Container
- type UpdateMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to a local Docker daemon.
func New ¶
New connects to the daemon (DOCKER_HOST or the default socket/pipe) and verifies it answers. The returned client must be Closed.
func (*Client) List ¶
List returns all containers; running ones carry live stats fetched concurrently (bounded), so many containers do not multiply the poll time. Stats are best-effort: zeros are fine when they fail.
func (*Client) Logs ¶
Logs opens the container log stream (multiplexed unless the container has a TTY). Cancel ctx to stop following.
type Container ¶
type Container struct {
ID string
Name string
Image string
State string
Status string
CPU float64 // percent of all cores
Mem uint64 // bytes
MemPct float64
NetRx uint64 // bytes, cumulative
NetTx uint64
BlkR uint64 // bytes, cumulative
BlkW uint64
}
Container is wrongtop's view of one container.