dockerhelper

package
v3.10.0-0.35.0+incompa... Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadDirFromContainer

func DownloadDirFromContainer(client Interface, container, src, dst string) error

DownloadDirFromContainer downloads an entire directory of files from a remote container.

func StreamFileFromContainer

func StreamFileFromContainer(client Interface, container, src string) (io.ReadCloser, error)

StreamFileFromContainer returns an io.ReadCloser from which the contents of a file in a remote container can be read.

func UploadFileToContainer

func UploadFileToContainer(client Interface, container, src, dest string) error

UploadFileToContainer uploads a file to a remote container.

Types

type Helper

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

Helper provides utility functions to help with Docker

func NewHelper

func NewHelper(client Interface) *Helper

NewHelper creates a new Helper

func (*Helper) APIVersion

func (h *Helper) APIVersion() (*types.Version, error)

Version returns the Docker API version and whether it is a Red Hat distro version

func (*Helper) CgroupDriver

func (h *Helper) CgroupDriver() (string, error)

func (*Helper) CheckAndPull

func (h *Helper) CheckAndPull(image string, out io.Writer) error

CheckAndPull checks whether a Docker image exists. If not, it pulls it.

func (*Helper) Client

func (h *Helper) Client() Interface

func (*Helper) ContainerLog

func (h *Helper) ContainerLog(container string, numLines int) string

func (*Helper) DockerRoot

func (h *Helper) DockerRoot() (string, error)

DockerRoot returns the root directory for Docker

func (*Helper) GetContainerState

func (h *Helper) GetContainerState(id string) (*types.ContainerJSON, bool, error)

GetContainerState returns whether a container exists and if it does whether it's running

func (*Helper) GetDockerProxySettings

func (h *Helper) GetDockerProxySettings() (httpProxy, httpsProxy, noProxy string, err error)

func (*Helper) HostIP

func (h *Helper) HostIP() string

HostIP returns the IP of the Docker host if connecting via TCP

func (*Helper) InsecureRegistryIsConfigured

func (h *Helper) InsecureRegistryIsConfigured(insecureRegistryCIDR string) (configured bool, hasEntries bool, error error)

InsecureRegistryIsConfigured checks to see if the Docker daemon has an appropriate insecure registry argument set so that our services can access the registry hasEntries specifies if Docker daemon has entries at all

func (*Helper) IsRedHat

func (h *Helper) IsRedHat() (bool, error)

func (*Helper) ListContainerNames

func (h *Helper) ListContainerNames() ([]string, error)

func (*Helper) RemoveContainer

func (h *Helper) RemoveContainer(id string) error

RemoveContainer removes the container with the given id

func (*Helper) StopAndRemoveContainer

func (h *Helper) StopAndRemoveContainer(container string) error

func (*Helper) UserNamespaceEnabled

func (h *Helper) UserNamespaceEnabled() (bool, error)

UserNamespaceEnabled checks whether docker daemon is running in user namespace mode.

type IPV4Range

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

IPV4Range represents a range of ipv4s

func (IPV4Range) Contains

func (r IPV4Range) Contains(aRange IPV4Range) bool

Contains returns whether an IPV4Range is contained within another IPV4Range

type IPV4RangeList

type IPV4RangeList []IPV4Range

IPV4RangeList represents a collection of IPV4Ranges

func (IPV4RangeList) Contains

func (l IPV4RangeList) Contains(r IPV4Range) bool

Contains returns true if the union of the ranges in this list completely contains the given range

func (IPV4RangeList) Len

func (l IPV4RangeList) Len() int

Len returns the length of entries within an IPV4RangeList

func (IPV4RangeList) Less

func (l IPV4RangeList) Less(i, j int) bool

Less returns whether a starting ipv4 at index i within this list, is less than a starting ipv4 at index j within this list

func (IPV4RangeList) Swap

func (l IPV4RangeList) Swap(i, j int)

Swap swaps entries within IPV4RangeList at indices i, and j

type Interface

type Interface interface {
	Endpoint() string
	Info() (*types.Info, error)
	ServerVersion() (*types.Version, error)
	ContainerCreate(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, name string) (*container.ContainerCreateCreatedBody, error)
	ContainerList(options types.ContainerListOptions) ([]types.Container, error)
	ContainerInspect(container string) (*types.ContainerJSON, error)
	ContainerRemove(container string, options types.ContainerRemoveOptions) error
	ContainerLogs(container string, options types.ContainerLogsOptions, stdOut, stdErr io.Writer) error
	ContainerStart(container string) error
	ContainerStop(container string, timeout int) error
	ContainerWait(container string) (int, error)
	CopyToContainer(container string, dest string, src io.Reader, options types.CopyToContainerOptions) error
	CopyFromContainer(container string, src string) (io.ReadCloser, error)
	ContainerExecCreate(container string, config types.ExecConfig) (*types.IDResponse, error)
	ContainerExecAttach(execID string, stdIn io.Reader, stdOut, stdErr io.Writer) error
	ContainerExecInspect(execID string) (*types.ContainerExecInspect, error)
	ImageInspectWithRaw(imageID string, getSize bool) (*types.ImageInspect, []byte, error)
	ImagePull(ref string, options types.ImagePullOptions, writer io.Writer) error
}

func NewClient

func NewClient(endpoint string, client *client.Client) Interface

NewClient creates an instance of the client Interface, given a docker engine client

type RegistryConfig

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

RegistryConfig contains useful Docker registry information. Built by NewRegistryConfig constructor

func NewRegistryConfig

func NewRegistryConfig(dockerInfo *types.Info) *RegistryConfig

NewRegistryConfig creates a new registry configuration

func (*RegistryConfig) ContainsInsecureRegistryCIDR

func (config *RegistryConfig) ContainsInsecureRegistryCIDR(cidr string) (bool, error)

ContainsInsecureRegistryCIDR returns whether a given CIDR is contained within the bounds of at least one CIDR configured in the Docker insecure registry configuration.

func (*RegistryConfig) HasCustomInsecureRegistryCIDRs

func (config *RegistryConfig) HasCustomInsecureRegistryCIDRs() bool

HasCustomInsecureRegistryCIDRs returns whether the user has any CIDRs configured within the Docker insecure registry configuration. This omits the inferred loopback entry in place implicitly by Docker.

Jump to

Keyboard shortcuts

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