github.com/kaixiang/packer@v0.5.2-0.20140114230416-1f5786b0d7f1/builder/docker/driver.go (about)

     1  package docker
     2  
     3  import (
     4  	"io"
     5  )
     6  
     7  // Driver is the interface that has to be implemented to communicate with
     8  // Docker. The Driver interface also allows the steps to be tested since
     9  // a mock driver can be shimmed in.
    10  type Driver interface {
    11  	// Export exports the container with the given ID to the given writer.
    12  	Export(id string, dst io.Writer) error
    13  
    14  	// Pull should pull down the given image.
    15  	Pull(image string) error
    16  
    17  	// StartContainer starts a container and returns the ID for that container,
    18  	// along with a potential error.
    19  	StartContainer(*ContainerConfig) (string, error)
    20  
    21  	// StopContainer forcibly stops a container.
    22  	StopContainer(id string) error
    23  
    24  	// Verify verifies that the driver can run
    25  	Verify() error
    26  }
    27  
    28  // ContainerConfig is the configuration used to start a container.
    29  type ContainerConfig struct {
    30  	Image      string
    31  	RunCommand []string
    32  	Volumes    map[string]string
    33  }
    34  
    35  // This is the template that is used for the RunCommand in the ContainerConfig.
    36  type startContainerTemplate struct {
    37  	Image   string
    38  	Volumes string
    39  }