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 ¶
- Variables
- func BuildImage(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)
- func Cleanup(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)
- func CreateClient(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)
- func ParallelBuild(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)
- func Push(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)
- func Start(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)
- func Wait(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)
- func WaitForStart(c cookoo.Context, p *cookoo.Params) (interface{}, cookoo.Interrupt)
- type BuildImg
- type Waiter
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
Cleanup removes any existing Docker artifacts.
Returns true if the file exists (and was deleted), or false if no file was deleted.
func CreateClient ¶
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 ¶
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 ¶
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 ¶
Start starts a Docker daemon.
This assumes the presence of the docker client on the host. It does not use the API.
func Wait ¶
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 ¶
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.