dockerclient

package
v0.0.0-...-da7d6d0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License: Apache-2.0 Imports: 27 Imported by: 2

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

Constants

This section is empty.

Variables

View Source
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

func GetECRAuth(registry, region string) (result docker.AuthConfiguration, err error)

GetECRAuth requests AWS ECR API to get docker.AuthConfiguration token

func GlobalCliParams

func GlobalCliParams() []cli.Flag

GlobalCliParams returns global params that configures docker client connection

func InfoCommandSpec

func InfoCommandSpec() cli.Command

InfoCommandSpec returns specifications of the info comment for codegangsta/cli

func IsInMatrix

func IsInMatrix() (bool, error)

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

func NewFromCli(c *cli.Context) (*docker.Client, error)

NewFromCli returns a new docker client connection with config built from cli params

func NewFromConfig

func NewFromConfig(config *Config) (*docker.Client, error)

NewFromConfig returns a new docker client connection with given config

func Ping

func Ping(client *docker.Client, timeoutMs int) error

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

type Config struct {
	Host      string
	Tlsverify bool
	Tlscacert string
	Tlscert   string
	Tlskey    string
}

Config represents docker client connection parameters

func NewConfig

func NewConfig() *Config

NewConfig returns new config with resolved options from current ENV

func NewConfigFromCli

func NewConfigFromCli(c *cli.Context) *Config

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL