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, _a1 string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
- func (_m *MockClient) ContainerCreate(ctx context.Context, config *container.Config, ...) (container.ContainerCreateCreatedBody, error)
- func (_m *MockClient) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
- func (_m *MockClient) ContainerExecCreate(ctx context.Context, _a1 string, config types.ExecConfig) (types.IDResponse, 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, _a1 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) 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, skipCache bool) 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
- func (_m *MockMachine) Stop(name string, timeout time.Duration) error
Constants ¶
const DefaultAPIVersion = "1.18"
The default API version used to create a new docker client.
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 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) ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, 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 the specified version is empty, it will use the default 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 Stop(name string, timeout time.Duration) error List() (machines []string, err error) Exist(name string) bool CanConnect(name string, skipCache bool) bool Credentials(name string) (DockerCredentials, error) }
func NewMachineCommand ¶
func NewMachineCommand() Machine
type MockClient ¶ added in v1.5.0
MockClient is an autogenerated mock type for the Client type
func (*MockClient) Close ¶
func (_m *MockClient) Close() error
Close provides a mock function with given fields:
func (*MockClient) ContainerAttach ¶
func (_m *MockClient) ContainerAttach(ctx context.Context, _a1 string, options types.ContainerAttachOptions) (types.HijackedResponse, error)
ContainerAttach provides a mock function with given fields: ctx, _a1, options
func (*MockClient) ContainerCreate ¶
func (_m *MockClient) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)
ContainerCreate provides a mock function with given fields: ctx, config, hostConfig, networkingConfig, containerName
func (*MockClient) ContainerExecAttach ¶
func (_m *MockClient) ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
ContainerExecAttach provides a mock function with given fields: ctx, execID, config
func (*MockClient) ContainerExecCreate ¶
func (_m *MockClient) ContainerExecCreate(ctx context.Context, _a1 string, config types.ExecConfig) (types.IDResponse, error)
ContainerExecCreate provides a mock function with given fields: ctx, _a1, config
func (*MockClient) ContainerInspect ¶
func (_m *MockClient) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
ContainerInspect provides a mock function with given fields: ctx, containerID
func (*MockClient) ContainerKill ¶
ContainerKill provides a mock function with given fields: ctx, containerID, signal
func (*MockClient) ContainerLogs ¶
func (_m *MockClient) ContainerLogs(ctx context.Context, _a1 string, options types.ContainerLogsOptions) (io.ReadCloser, error)
ContainerLogs provides a mock function with given fields: ctx, _a1, options
func (*MockClient) ContainerRemove ¶
func (_m *MockClient) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
ContainerRemove provides a mock function with given fields: ctx, containerID, options
func (*MockClient) ContainerStart ¶
func (_m *MockClient) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
ContainerStart provides a mock function with given fields: ctx, containerID, options
func (*MockClient) ImageImportBlocking ¶
func (_m *MockClient) ImageImportBlocking(ctx context.Context, source types.ImageImportSource, ref string, options types.ImageImportOptions) error
ImageImportBlocking provides a mock function with given fields: ctx, source, ref, options
func (*MockClient) ImageInspectWithRaw ¶
func (_m *MockClient) ImageInspectWithRaw(ctx context.Context, imageID string) (types.ImageInspect, []byte, error)
ImageInspectWithRaw provides a mock function with given fields: ctx, imageID
func (*MockClient) ImagePullBlocking ¶
func (_m *MockClient) ImagePullBlocking(ctx context.Context, ref string, options types.ImagePullOptions) error
ImagePullBlocking provides a mock function with given fields: ctx, ref, options
func (*MockClient) NetworkDisconnect ¶
func (_m *MockClient) NetworkDisconnect(ctx context.Context, networkID string, containerID string, force bool) error
NetworkDisconnect provides a mock function with given fields: ctx, networkID, containerID, force
func (*MockClient) NetworkList ¶
func (_m *MockClient) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)
NetworkList provides a mock function with given fields: ctx, options
type MockMachine ¶ added in v1.5.0
MockMachine is an autogenerated mock type for the Machine type
func (*MockMachine) CanConnect ¶ added in v1.5.0
func (_m *MockMachine) CanConnect(name string, skipCache bool) bool
CanConnect provides a mock function with given fields: name, skipCache
func (*MockMachine) Create ¶ added in v1.5.0
func (_m *MockMachine) Create(driver string, name string, opts ...string) error
Create provides a mock function with given fields: driver, name, opts
func (*MockMachine) Credentials ¶ added in v1.5.0
func (_m *MockMachine) Credentials(name string) (DockerCredentials, error)
Credentials provides a mock function with given fields: name
func (*MockMachine) Exist ¶ added in v1.5.0
func (_m *MockMachine) Exist(name string) bool
Exist provides a mock function with given fields: name
func (*MockMachine) List ¶ added in v1.5.0
func (_m *MockMachine) List() ([]string, error)
List provides a mock function with given fields:
func (*MockMachine) Provision ¶ added in v1.5.0
func (_m *MockMachine) Provision(name string) error
Provision provides a mock function with given fields: name
func (*MockMachine) Remove ¶ added in v1.5.0
func (_m *MockMachine) Remove(name string) error
Remove provides a mock function with given fields: name