Documentation
¶
Index ¶
- Constants
- func CheckDockerCompose(versionConstraint string) error
- func CheckDockerVersion(versionConstraint string) error
- func CheckForHTTPS(container docker.APIContainers) bool
- func ComposeCmd(composeFiles []string, action ...string) (string, string, error)
- func ComposeNoCapture(composeFiles []string, action ...string) error
- func ContainerName(container docker.APIContainers) string
- func ContainerWait(waittime time.Duration, labels map[string]string) error
- func EnsureDdevNetwork()
- func EnsureNetwork(client *docker.Client, name string) error
- func FindContainerByLabels(labels map[string]string) (docker.APIContainers, error)
- func FindContainersByLabels(labels map[string]string) ([]docker.APIContainers, error)
- func GetAppContainers(sitename string) ([]docker.APIContainers, error)
- func GetContainerEnv(key string, container docker.APIContainers) string
- func GetContainerHealth(container docker.APIContainers) string
- func GetDockerClient() *docker.Client
- func GetDockerContainers(allContainers bool) ([]docker.APIContainers, error)
- func GetDockerIP() (string, error)
- func GetPublishedPort(privatePort int64, container docker.APIContainers) int
- func NetExists(client *docker.Client, name string) bool
- func RunSimpleContainer(image string, name string, cmd []string, entrypoint []string, env []string, ...) (string, error)
Constants ¶
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
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 ¶
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 ¶
ComposeCmd executes docker-compose commands via shell. returns stdout, stderr, error/nil
func ComposeNoCapture ¶ added in v0.9.4
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 ¶
ContainerWait provides a wait loop to check for container in "healthy" status. timeout is in seconds. This is modeled on https://gist.github.com/ngauthier/d6e6f80ce977bedca601
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 ¶
EnsureNetwork will ensure the docker network for ddev is created.
func FindContainerByLabels ¶
FindContainerByLabels takes a map of label names and values and returns any docker containers which match all labels.
func FindContainersByLabels ¶
FindContainersByLabels takes a map of label names and values and returns any docker containers which match all labels.
func GetAppContainers ¶
GetAppContainers retrieves docker containers for a given sitename.
func GetContainerEnv ¶
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 ¶
GetDockerContainers returns a slice of all docker containers on the host system.
func GetDockerIP ¶ added in v0.19.0
GetDockerIP returns either the default Docker IP address (127.0.0.1) or the value as configured by $DOCKER_HOST.
func GetPublishedPort ¶
GetPublishedPort returns the published port for a given private port.
func RunSimpleContainer ¶ added in v1.1.0
func RunSimpleContainer(image string, name string, cmd []string, entrypoint []string, env []string, binds []string, uid string) (string, error)
RunSimpleContainer runs a container (non-daemonized) and captures the stdout. It will block, so not to be run on a container whose entryoint or cmd might hang or run too long. This should be the equivalent of something like docker run -t -u '%s:%s' -e SNAPSHOT_NAME='%s' -v '%s:/mnt/ddev_config' -v '%s:/var/lib/mysql' --rm --entrypoint=/migrate_file_to_volume.sh %s:%s" Example code from https://gist.github.com/fsouza/b0bf3043827f8e39c4589e88cec067d8
Types ¶
This section is empty.