2013-11-09 15:12:23 -05:00
|
|
|
package docker
|
|
|
|
|
2013-11-09 16:15:51 -05:00
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
)
|
|
|
|
|
2013-11-09 15:12:23 -05:00
|
|
|
// Driver is the interface that has to be implemented to communicate with
|
|
|
|
// Docker. The Driver interface also allows the steps to be tested since
|
|
|
|
// a mock driver can be shimmed in.
|
|
|
|
type Driver interface {
|
2014-01-19 22:48:06 -05:00
|
|
|
// Delete an image that is imported into Docker
|
|
|
|
DeleteImage(id string) error
|
|
|
|
|
2013-11-09 16:15:51 -05:00
|
|
|
// Export exports the container with the given ID to the given writer.
|
|
|
|
Export(id string, dst io.Writer) error
|
|
|
|
|
2014-01-19 22:55:01 -05:00
|
|
|
// Import imports a container from a tar file
|
|
|
|
Import(path, repo string) (string, error)
|
|
|
|
|
2013-11-09 15:12:23 -05:00
|
|
|
// Pull should pull down the given image.
|
|
|
|
Pull(image string) error
|
2013-11-09 16:03:01 -05:00
|
|
|
|
2014-01-19 23:42:42 -05:00
|
|
|
// Push pushes an image to a Docker index/registry.
|
|
|
|
Push(name string) error
|
|
|
|
|
2013-11-09 16:03:01 -05:00
|
|
|
// StartContainer starts a container and returns the ID for that container,
|
|
|
|
// along with a potential error.
|
|
|
|
StartContainer(*ContainerConfig) (string, error)
|
|
|
|
|
|
|
|
// StopContainer forcibly stops a container.
|
|
|
|
StopContainer(id string) error
|
2013-11-10 00:26:05 -05:00
|
|
|
|
|
|
|
// Verify verifies that the driver can run
|
|
|
|
Verify() error
|
2013-11-09 16:03:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// ContainerConfig is the configuration used to start a container.
|
|
|
|
type ContainerConfig struct {
|
2013-12-27 12:17:45 -05:00
|
|
|
Image string
|
|
|
|
RunCommand []string
|
|
|
|
Volumes map[string]string
|
|
|
|
}
|
|
|
|
|
|
|
|
// This is the template that is used for the RunCommand in the ContainerConfig.
|
|
|
|
type startContainerTemplate struct {
|
2013-11-09 16:03:01 -05:00
|
|
|
Image string
|
2013-12-27 12:17:45 -05:00
|
|
|
Volumes string
|
2013-11-09 15:12:23 -05:00
|
|
|
}
|