dockerclient

package
Version: v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: MIT Imports: 16 Imported by: 0

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

View Source
const (
	DefaultVersion   = "1.37"
	DefaultLocalHost = "unix:///var/run/docker.sock"
)

Variables

This section is empty.

Functions

func DecodeDockerError

func DecodeDockerError(status int, body []byte, res *http.Response) (decodedError error)

Types

type Client

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

func New

func New(host string) (*Client, error)

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

func (dc *Client) Ping() (types.Ping, error)

func (*Client) Version

func (dc *Client) Version() (types.Version, error)

type ErrDocker

type ErrDocker struct {
	Method httputil.Method
	Url    string
	Path   string
	Status int
	// Message is the decoded error message from docker daemon
	Message string
	Body    string
}

func (*ErrDocker) Error

func (e *ErrDocker) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL