Documentation ¶
Overview ¶
Package dockerclient provides utilities for embedding docker client functionality to other tools. It provides configurable docker client connection functions, config struct, integration with codegangsta/cli.
Index ¶
- Variables
- func GetAuthForRegistry(auth *docker.AuthConfigurations, image *imagename.ImageName) (result docker.AuthConfiguration, err error)
- func GetECRAuth(registry, region string) (result docker.AuthConfiguration, err error)
- func GlobalCliParams() []cli.Flag
- func InfoCommandSpec() cli.Command
- func IsInMatrix() (bool, error)
- func New() (*docker.Client, error)
- func NewFromCli(c *cli.Context) (*docker.Client, error)
- func NewFromConfig(config *Config) (*docker.Client, error)
- func Ping(client *docker.Client, timeoutMs int) error
- func RegistryListTags(image *imagename.ImageName, auth *docker.AuthConfigurations) (images []*imagename.ImageName, err error)
- func ResolveHostPath(mountPath string, client *docker.Client, isUnixSocket bool, ...) (string, error)
- type Config
- type ErrDriverNotSupported
Constants ¶
This section is empty.
Variables ¶
var (
// DefaultEndpoint is the default address of Docker socket
DefaultEndpoint = "unix:///var/run/docker.sock"
)
Functions ¶
func GetAuthForRegistry ¶
func GetAuthForRegistry(auth *docker.AuthConfigurations, image *imagename.ImageName) (result docker.AuthConfiguration, err error)
GetAuthForRegistry extracts desired docker.AuthConfiguration object from the list of docker.AuthConfigurations by registry hostname
func GetECRAuth ¶
GetECRAuth requests AWS ECR API to get docker.AuthConfiguration token
func GlobalCliParams ¶
GlobalCliParams returns global params that configures docker client connection
func InfoCommandSpec ¶
InfoCommandSpec returns specifications of the info comment for codegangsta/cli
func IsInMatrix ¶
IsInMatrix returns true if current process is running inside of a docker container
func New ¶
func New() (*docker.Client, error)
New returns a new docker client connection with default config
func NewFromCli ¶
NewFromCli returns a new docker client connection with config built from cli params
func NewFromConfig ¶
NewFromConfig returns a new docker client connection with given config
func Ping ¶
Ping pings docker client but with timeout The problem is that for some reason it's impossible to set the default timeout for the go-dockerclient Dialer, need to investigate
func RegistryListTags ¶
func RegistryListTags(image *imagename.ImageName, auth *docker.AuthConfigurations) (images []*imagename.ImageName, err error)
RegistryListTags returns the list of images instances obtained from all tags existing in the registry
func ResolveHostPath ¶
func ResolveHostPath(mountPath string, client *docker.Client, isUnixSocket bool, unixSocketPath string) (string, error)
ResolveHostPath resolves any given path from the current context so it is mountable by any container.
If the current process is executed in the container itself, this function resolves the given path according to the container's rootfs on the host machine. It also considers the mounted directories to the current container, so if given path is pointing to the mounted directory, it resolves correctly.
Types ¶
type Config ¶
Config represents docker client connection parameters
func NewConfig ¶
func NewConfig() *Config
NewConfig returns new config with resolved options from current ENV
func NewConfigFromCli ¶
NewConfigFromCli returns new config with NewConfig overridden cli options
type ErrDriverNotSupported ¶
type ErrDriverNotSupported struct {
Driver string
}
ErrDriverNotSupported is an error type that is returned if it's impossible to ResolveHostPath using current fs driver
func (*ErrDriverNotSupported) Error ¶
func (e *ErrDriverNotSupported) Error() string
Error returns error string