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 ComposeWithStreams(composeFiles []string, stdin io.Reader, stdout io.Writer, stderr io.Writer, ...) error
- func ContainerName(container docker.APIContainers) string
- func ContainerWait(waittime int, labels map[string]string) (string, error)
- func ContainerWaitLog(waittime int, labels map[string]string, expectedLog string) (string, error)
- func CreateVolume(volumeName string, driver string, driverOpts map[string]string) (volume *docker.Volume, err error)
- func EnsureDdevNetwork()
- func EnsureNetwork(client *docker.Client, name string) error
- func FindContainerByLabels(labels map[string]string) (*docker.APIContainers, error)
- func FindContainerByName(name 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, string)
- func GetDockerClient() *docker.Client
- func GetDockerContainers(allContainers bool) ([]docker.APIContainers, error)
- func GetDockerIP() (string, error)
- func GetExposedContainerPorts(containerID string) ([]string, error)
- func GetHostDockerInternalIP() (string, error)
- func GetPublishedPort(privatePort int64, container docker.APIContainers) int
- func ImageExistsLocally(imageName string) (bool, error)
- func InvalidateDockerWindowsCache() error
- func MassageWindowsHostMountpoint(mountPoint string) string
- func MassageWindowsNFSMount(mountPoint string) string
- func NetExists(client *docker.Client, name string) bool
- func Pull(imageName string) error
- func RemoveContainer(id string, timeout uint) error
- func RemoveImage(tag string) error
- func RemoveVolume(volumeName string) error
- func RunSimpleContainer(image string, name string, cmd []string, entrypoint []string, env []string, ...) (containerID string, output string, returnErr error)
- func VolumeExists(volumeName string) bool
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 ComposeWithStreams ¶ added in v1.4.0
func ComposeWithStreams(composeFiles []string, stdin io.Reader, stdout io.Writer, stderr io.Writer, action ...string) error
ComposeWithStreams executes a docker-compose command but allows the caller to specify stdin/stdout/stderr
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. waittime is in seconds. This is modeled on https://gist.github.com/ngauthier/d6e6f80ce977bedca601 Returns logoutput, error, returns error if not "healthy"
func ContainerWaitLog ¶ added in v1.5.0
ContainerWaitLog provides a wait loop to check for container in "healthy" status. with a given log output timeout is in seconds. This is modeled on https://gist.github.com/ngauthier/d6e6f80ce977bedca601 Returns logoutput, error, returns error if not "healthy"
func CreateVolume ¶ added in v1.5.9
func CreateVolume(volumeName string, driver string, driverOpts map[string]string) (volume *docker.Volume, err error)
CreateVolume creates a docker volume
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 FindContainerByName ¶ added in v1.5.9
FindContainerByName takes a container name and returns the container
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 ¶
GetContainerHealth retrieves the health status of a given container. returns status, most-recent-log
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 GetExposedContainerPorts ¶ added in v1.5.0
GetExposedContainerPorts takes a container pointer and returns an array of exposed ports (and error)
func GetHostDockerInternalIP ¶ added in v1.5.9
GetHostDockerInternalIP() returns either "host.docker.internal" (for docker-for-mac and Win10 Docker-for-windows) or a usable IP address for docker toolbox and linux.
func GetPublishedPort ¶
GetPublishedPort returns the published port for a given private port.
func ImageExistsLocally ¶ added in v1.2.0
ImageExistsLocally determines if an image is available locally.
func InvalidateDockerWindowsCache ¶ added in v1.14.1
func InvalidateDockerWindowsCache() error
InvalidateDockerWindowsCache On Windows, invalidate the docker cache since it's asynchronous Synchronously delete docker cache so these things don't show up in the next test Suggested in https://github.com/docker/for-win/issues/5530#issuecomment-620812432
func MassageWindowsHostMountpoint ¶ added in v1.4.0
MassageWindowsHostMountpoint changes C:/path/to/something to //c/path/to/something THis is required for docker bind mounts on docker toolbox. Sadly, if we have a Windows drive name, it has to be converted from C:/ to //c for Win10Home/Docker toolbox
func MassageWindowsNFSMount ¶ added in v1.9.0
MassageWindowsNFSMount changes C:\Path\to\something to /c/Path/to/something
func RemoveContainer ¶ added in v1.4.0
RemoveContainer stops and removes a container
func RemoveVolume ¶ added in v1.5.0
RemoveVolume removes named volume. Does not throw error if the volume did not exist.
func RunSimpleContainer ¶ added in v1.1.0
func RunSimpleContainer(image string, name string, cmd []string, entrypoint []string, env []string, binds []string, uid string, removeContainerAfterRun bool) (containerID string, output string, returnErr error)
RunSimpleContainer runs a container (non-daemonized) and captures the stdout. It will block, so not to be run on a container whose entrypoint 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 Returns containerID, output, error
func VolumeExists ¶ added in v1.14.0
VolumeExists checks to see if the named volume exists.
Types ¶
This section is empty.