Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeAuthConfig(authConfig *types.AuthConfig) (string, error)
- func IsErrNotFound(err error) bool
- func ReadAuthConfigsFromReader(r io.Reader) (map[string]types.AuthConfig, error)
- func ReadDockerAuthConfigsFromHomeDir(userName string) (map[string]types.AuthConfig, error)
- func ResolveDockerAuthConfig(indexName string, configs map[string]types.AuthConfig) *types.AuthConfig
- func SplitDockerImageName(reposName string) (string, string)
- type Client
- type DockerCredentials
- type Machine
- type MockClient
- func (m *MockClient) Close() error
- func (m *MockClient) ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
- func (m *MockClient) ContainerCreate(ctx context.Context, config *container.Config, ...) (container.ContainerCreateCreatedBody, error)
- func (m *MockClient) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
- func (m *MockClient) ContainerKill(ctx context.Context, containerID string, signal string) error
- func (m *MockClient) ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error)
- func (m *MockClient) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
- func (m *MockClient) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
- func (m *MockClient) ContainerWait(ctx context.Context, containerID string) (int64, error)
- func (m *MockClient) ImageImportBlocking(ctx context.Context, source types.ImageImportSource, ref string, ...) error
- func (m *MockClient) ImageInspectWithRaw(ctx context.Context, imageID string) (types.ImageInspect, []byte, error)
- func (m *MockClient) ImagePullBlocking(ctx context.Context, ref string, options types.ImagePullOptions) error
- func (m *MockClient) Info(ctx context.Context) (types.Info, error)
- func (m *MockClient) NetworkDisconnect(ctx context.Context, networkID string, containerID string, force bool) error
- func (m *MockClient) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)
- type MockMachine
- func (m *MockMachine) CanConnect(name string) bool
- func (m *MockMachine) Create(driver string, name string, opts ...string) error
- func (m *MockMachine) Credentials(name string) (DockerCredentials, error)
- func (m *MockMachine) Exist(name string) bool
- func (m *MockMachine) List() ([]string, error)
- func (m *MockMachine) Provision(name string) error
- func (m *MockMachine) Remove(name string) error
Constants ¶
const DefaultDockerRegistry = "docker.io"
DefaultDockerRegistry is the name of the index
Variables ¶
var HomeDirectory = homedir.Get()
Functions ¶
func EncodeAuthConfig ¶
func EncodeAuthConfig(authConfig *types.AuthConfig) (string, error)
EncodeAuthConfig constructs a token from an AuthConfig, suitable for authorizing against the Docker API with.
func IsErrNotFound ¶
IsErrNotFound checks whether a returned error is due to an image or container not being found. Proxies the docker implementation.
func ReadDockerAuthConfigsFromHomeDir ¶ added in v1.8.0
func ReadDockerAuthConfigsFromHomeDir(userName string) (map[string]types.AuthConfig, error)
func ResolveDockerAuthConfig ¶
func ResolveDockerAuthConfig(indexName string, configs map[string]types.AuthConfig) *types.AuthConfig
ResolveDockerAuthConfig taken from: https://github.com/docker/docker/blob/master/registry/auth.go
func SplitDockerImageName ¶
SplitDockerImageName breaks a reposName into an index name and remote name
Types ¶
type Client ¶
type Client interface { ImageInspectWithRaw(ctx context.Context, imageID string) (types.ImageInspect, []byte, error) ImagePullBlocking(ctx context.Context, ref string, options types.ImagePullOptions) error ImageImportBlocking(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) error ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error ContainerWait(ctx context.Context, containerID string) (int64, error) ContainerKill(ctx context.Context, containerID, signal string) error ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error) ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) NetworkDisconnect(ctx context.Context, networkID, containerID string, force bool) error NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error) Info(ctx context.Context) (types.Info, error) Close() error }
func New ¶
func New(c DockerCredentials, apiVersion string) (Client, error)
New attempts to create a new Docker client of the specified version.
If no host is given in the DockerCredentials, it will attempt to look up details from the environment. If that fails, it will use the default connection details for your platform.
type DockerCredentials ¶
type DockerCredentials struct { Host string `toml:"host,omitempty" json:"host" long:"host" env:"DOCKER_HOST" description:"Docker daemon address"` CertPath string `toml:"tls_cert_path,omitempty" json:"tls_cert_path" long:"cert-path" env:"DOCKER_CERT_PATH" description:"Certificate path"` TLSVerify bool `` /* 129-byte string literal not displayed */ }
type Machine ¶
type Machine interface { Create(driver, name string, opts ...string) error Provision(name string) error Remove(name string) error List() (machines []string, err error) Exist(name string) bool CanConnect(name string) bool Credentials(name string) (DockerCredentials, error) }
func NewMachineCommand ¶
func NewMachineCommand() Machine
type MockClient ¶ added in v1.5.0
func (*MockClient) Close ¶
func (m *MockClient) Close() error
func (*MockClient) ContainerAttach ¶
func (m *MockClient) ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
func (*MockClient) ContainerCreate ¶
func (m *MockClient) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)
func (*MockClient) ContainerInspect ¶
func (m *MockClient) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
func (*MockClient) ContainerKill ¶
func (*MockClient) ContainerLogs ¶
func (m *MockClient) ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error)
func (*MockClient) ContainerRemove ¶
func (m *MockClient) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
func (*MockClient) ContainerStart ¶
func (m *MockClient) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
func (*MockClient) ContainerWait ¶
func (*MockClient) ImageImportBlocking ¶
func (m *MockClient) ImageImportBlocking(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) error
func (*MockClient) ImageInspectWithRaw ¶
func (m *MockClient) ImageInspectWithRaw(ctx context.Context, imageID string) (types.ImageInspect, []byte, error)
func (*MockClient) ImagePullBlocking ¶
func (m *MockClient) ImagePullBlocking(ctx context.Context, ref string, options types.ImagePullOptions) error
func (*MockClient) NetworkDisconnect ¶
func (*MockClient) NetworkList ¶
func (m *MockClient) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)
type MockMachine ¶ added in v1.5.0
func (*MockMachine) CanConnect ¶ added in v1.5.0
func (m *MockMachine) CanConnect(name string) bool
func (*MockMachine) Create ¶ added in v1.5.0
func (m *MockMachine) Create(driver string, name string, opts ...string) error
func (*MockMachine) Credentials ¶ added in v1.5.0
func (m *MockMachine) Credentials(name string) (DockerCredentials, error)
func (*MockMachine) Exist ¶ added in v1.5.0
func (m *MockMachine) Exist(name string) bool
func (*MockMachine) List ¶ added in v1.5.0
func (m *MockMachine) List() ([]string, error)
func (*MockMachine) Provision ¶ added in v1.5.0
func (m *MockMachine) Provision(name string) error
func (*MockMachine) Remove ¶ added in v1.5.0
func (m *MockMachine) Remove(name string) error