Documentation ¶
Overview ¶
Package dockerclient is a docker client that only uses types defined in docker. It is an example for httpclient package, it is currently in tree and will be moved to its own repo
Index ¶
- Constants
- func DecodeDockerError(status int, body []byte, res *http.Response) (decodedError error)
- type Client
- func (dc *Client) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (net.Conn, error)
- func (dc *Client) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
- func (dc *Client) ContainerKill(ctx context.Context, containerId, signal string) error
- func (dc *Client) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
- func (dc *Client) ContainerLog(ctx context.Context, containerNameOrId string, ...) (io.ReadCloser, error)
- func (dc *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
- func (dc *Client) Ping() (types.Ping, error)
- func (dc *Client) Version() (types.Version, error)
- type ErrDocker
Constants ¶
const ( DefaultVersion = "1.37" DefaultLocalHost = "unix:///var/run/docker.sock" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ContainerExecAttach ¶ added in v0.0.3
func (dc *Client) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (net.Conn, error)
TODO: Attach is using the same start API but hijack the raw stream NOTE: docker is using the deprecated httputil.ClientConn https://github.com/moby/moby/blob/master/client/hijack.go#L53
func (*Client) ContainerExecCreate ¶ added in v0.0.3
func (dc *Client) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
https://github.com/docker/cli/blob/master/cli/command/container/exec.go https://github.com/moby/moby/blob/master/client/container_exec.go
func (*Client) ContainerKill ¶
TODO: signal should be typed TODO: kill -l to list all the signals https://www.linux.org/threads/kill-commands-and-signals.8881/ https://github.com/docker/cli/blob/master/cli/command/container/kill.go https://github.com/moby/moby/blob/master/client/container_kill.go
func (*Client) ContainerList ¶ added in v0.0.3
func (dc *Client) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
https://github.com/docker/cli/blob/master/cli/command/container/list.go https://github.com/moby/moby/blob/master/client/container_list.go https://docs.docker.com/engine/reference/commandline/ps/#usage
func (*Client) ContainerLog ¶ added in v0.0.3
func (dc *Client) ContainerLog(ctx context.Context, containerNameOrId string, options types.ContainerLogsOptions) (io.ReadCloser, error)
https://github.com/moby/moby/blob/master/client/container_logs.go https://github.com/docker/cli/blob/master/cli/command/container/logs.go https://docs.docker.com/engine/reference/commandline/logs/#options
docker run --name test -d busybox sh -c "while true; do $(echo date); sleep 1; done"
func (*Client) ImageList ¶
func (dc *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
https://github.com/moby/moby/blob/master/client/image_list.go