Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DockerInfo = func() string { out, err := exec.Command("docker", "info").Output() if err != nil { panic(err.Error()) } else { return string(out) } }
DockerInfo shells out the command 'docker -info', returning the information if the command is successful and panicking if not.
var DockerPull = func(image string) { out := exec.Command("docker", "pull", image) out.Stdin = os.Stdin out.Stdout = os.Stderr out.Stderr = os.Stderr out.Run() }
DockerPull shells out the command 'docker pull {{image}}' where image is the name of a Docker image to retrieve from the remote Docker repository.
var DockerVersion = func() string { out, err := exec.Command("docker", "-v").Output() if err != nil { panic(err.Error()) } else { return string(out) } }
DockerVersion shells out the command 'docker -v', returning the version information if the command is successful, and panicking if not.
Functions ¶
func ExtractDockerVersion ¶
ExtractDockerVersion takes a Docker version string in the format: 'Docker version 1.0.0, build abcdef0', extracts the major, minor and patch versions and returns these as a tuple. If the string does not match, panic.
func IsDockerPresent ¶
func IsDockerPresent() (present bool)
IsDockerPresent tests for the presence of Docker by invoking DockerVersion to get the version of Docker if available, and then attempting to parse the version with ExtractDocker version. This function will return true only if neither of these functions panics.
func IsDockerRunning ¶
func IsDockerRunning() (running bool)
IsDockerRunning tests whether Docker is running by invoking DockerInfo which will only return information if Docker is up. This function will return true if DockerInfo does not panic.
func RunAnonymousContainer ¶
RunAnonymousContainer shells out the command: 'docker run --rm {{extraDockerArgs}} -t {{image}} {{entrypointArgs}}'. This will run an anonymouse Docker container with the specified image, with any extra arguments to pass to Docker, for example directories to mount, as well as arguments to pass to the image's entrypoint.
Types ¶
This section is empty.