dockerutil

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const NetName = "ddev_default"

NetName provides the default network name for ddev.

Variables

This section is empty.

Functions

func CheckDockerCompose added in v0.11.0

func CheckDockerCompose(versionConstraint string) error

CheckDockerCompose determines if docker-compose is present and executable on the host system. This relies on docker-compose being somewhere in the user's $PATH.

func CheckDockerVersion

func CheckDockerVersion(versionConstraint string) error

CheckDockerVersion determines if the docker version of the host system meets the provided version constraints. See https://godoc.org/github.com/Masterminds/semver#hdr-Checking_Version_Constraints for examples defining version constraints.

func CheckForHTTPS added in v0.9.4

func CheckForHTTPS(container docker.APIContainers) bool

CheckForHTTPS determines if a container has the HTTPS_EXPOSE var set to route 443 traffic to 80

func ComposeCmd

func ComposeCmd(composeFiles []string, action ...string) (string, string, error)

ComposeCmd executes docker-compose commands via shell. returns stdout, stderr, error/nil

func ComposeNoCapture added in v0.9.4

func ComposeNoCapture(composeFiles []string, action ...string) error

ComposeNoCapture executes a docker-compose command while leaving the stdin/stdout/stderr untouched so that people can interact with them directly, for example with ddev ssh. Note that this function will never return an actual error because we don't have a way to distinguish between an error representing a failure to connect to the container and an error representing a command failing inside of the interactive session inside the container.

func ContainerName

func ContainerName(container docker.APIContainers) string

ContainerName returns the containers human readable name.

func ContainerWait

func ContainerWait(timeout time.Duration, labels map[string]string) error

ContainerWait provides a wait loop to check for container in "healthy" status. timeout is in seconds.

func EnsureDdevNetwork added in v0.9.4

func EnsureDdevNetwork()

EnsureDdevNetwork just creates or ensures the ddev_default network exists or exits with fatal.

func EnsureNetwork

func EnsureNetwork(client *docker.Client, name string) error

EnsureNetwork will ensure the docker network for ddev is created.

func FindContainerByLabels

func FindContainerByLabels(labels map[string]string) (docker.APIContainers, error)

FindContainerByLabels takes a map of label names and values and returns any docker containers which match all labels.

func FindContainersByLabels

func FindContainersByLabels(labels map[string]string) ([]docker.APIContainers, error)

FindContainersByLabels takes a map of label names and values and returns any docker containers which match all labels.

func GetAppContainers

func GetAppContainers(sitename string) ([]docker.APIContainers, error)

GetAppContainers retrieves docker containers for a given sitename.

func GetContainerEnv

func GetContainerEnv(key string, container docker.APIContainers) string

GetContainerEnv returns the value of a given environment variable from a given container.

func GetContainerHealth

func GetContainerHealth(container docker.APIContainers) string

GetContainerHealth retrieves the status of a given container. The status string returned by docker contains uptime and the health status in parenths. This function will filter the uptime and return only the health status.

func GetDockerClient

func GetDockerClient() *docker.Client

GetDockerClient returns a docker client for a docker-machine.

func GetDockerContainers

func GetDockerContainers(allContainers bool) ([]docker.APIContainers, error)

GetDockerContainers returns a slice of all docker containers on the host system.

func GetPublishedPort

func GetPublishedPort(privatePort int64, container docker.APIContainers) int64

GetPublishedPort returns the published port for a given private port.

func NetExists

func NetExists(client *docker.Client, name string) bool

NetExists checks to see if the docker network for ddev exists.

Types

This section is empty.

Jump to

Keyboard shortcuts

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