docker

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2015 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package docker provides Docker utlities.

Some of the utilities rely upon the presence of the command line client for Docker. Others use the Docker API.

Index

Constants

This section is empty.

Variables

View Source
var DockSock = "/var/run/docker.sock"

Path to the Docker unix socket. TODO: When we switch to a newer Docker library, we should favor this:

var DockSock = opts.DefaultUnixSocket

Functions

func BuildImage

func BuildImage(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)

BuildImage builds a docker image.

Essentially, this executes:

docker build -t TAG PATH

Params:

  • path (string): The path to the image. REQUIRED
  • tag (string): The tag to build.

func Cleanup

func Cleanup(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)

Cleanup removes any existing Docker artifacts.

Returns true if the file exists (and was deleted), or false if no file was deleted.

func CreateClient

func CreateClient(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)

CreateClient creates a new Docker client.

Params:

  • url (string): The URI to the Docker daemon. This defaults to the UNIX socket /var/run/docker.sock.

Returns:

  • *docker.Client

func ParallelBuild

func ParallelBuild(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)

ParallelBuild runs multiple docker builds at the same time.

Params:

-images ([]BuildImg): Images to build
-alwaysFetch (bool): Default false. If set to true, this will always fetch
	the Docker image even if it already exists in the registry.

Returns:

  • Waiter: A *sync.WaitGroup that is waiting for the docker downloads to finish.

Context:

This puts 'ParallelBuild.failN" (int) into the context to indicate how many failures occurred during fetches.

func Push

func Push(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)

Push pushes an image to the registry.

This finds the appropriate registry by looking it up in etcd.

Params: - client (etcd.Getter): Client to do etcd lookups. - tag (string): Tag to push.

Returns:

func Start

func Start(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)

Start starts a Docker daemon.

This assumes the presence of the docker client on the host. It does not use the API.

func Wait

func Wait(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)

Wait waits for a sync.WaitGroup to finish.

Params:

  • wg (Waiter): The thing to wait for.
  • msg (string): The message to print when done. If this is empty, nothing is sent.
  • waiting (string): String to tell what we're waiting for. If empty, nothing is displayed.
  • failures (int): The number of failures that occurred while waiting.

Returns:

Nothing.

func WaitForStart

func WaitForStart(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)

WaitForStart delays until Docker appears to be up and running.

Params:

  • client (*docker.Client): Docker client.
  • timeout (time.Duration): Time after which to give up.

Returns:

  • boolean true if the server is up.

Types

type BuildImg

type BuildImg struct {
	Path, Tag string
}

BuildImg describes a build image.

type Waiter

type Waiter interface {
	Wait()
}

Waiter describes a thing that can wait.

It does not bring you food. I should know. I tried.

Jump to

Keyboard shortcuts

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