{"modulePath":"github.com/stackpointcloud/packer","version":"v0.10.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package docker\n\n## Constants\n\n```go\nconst (\n\tBuilderId       = \"packer.docker\"\n\tBuilderIdImport = \"packer.post-processor.docker-import\"\n)\n```\n\n## Types\n\n```go\ntype Builder struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (b *Builder) Cancel()\n```\n\n```go\nfunc (b *Builder) Prepare(raws ...interface{}) ([]string, error)\n```\n\n```go\nfunc (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error)\n```\n\n```go\ntype Communicator struct {\n\tContainerId  string\n\tHostDir      string\n\tContainerDir string\n\tVersion      *version.Version\n\tConfig       *Config\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (c *Communicator) Download(src string, dst io.Writer) error\n```\nDownload pulls a file out of a container using \\`docker cp\\`. We have a source path and want to write to an io.Writer, not a file. We use - to make docker cp to write to stdout, and then copy the stream to our destination io.Writer.\n\n```go\nfunc (c *Communicator) DownloadDir(src string, dst string, exclude []string) error\n```\n\n```go\nfunc (c *Communicator) Start(remote *packer.RemoteCmd) error\n```\n\n```go\nfunc (c *Communicator) Upload(dst string, src io.Reader, fi *os.FileInfo) error\n```\n\n```go\nfunc (c *Communicator) UploadDir(dst string, src string, exclude []string) error\n```\n\n```go\ntype Config struct {\n\tcommon.PackerConfig `mapstructure:\",squash\"`\n\tComm                communicator.Config `mapstructure:\",squash\"`\n\n\tCommit     bool\n\tDiscard    bool\n\tExportPath string `mapstructure:\"export_path\"`\n\tImage      string\n\tPty        bool\n\tPull       bool\n\tRunCommand []string `mapstructure:\"run_command\"`\n\tVolumes    map[string]string\n\tPrivileged bool `mapstructure:\"privileged\"`\n\n\t// This is used to login to dockerhub to pull a private base container. For\n\t// pushing to dockerhub, see the docker post-processors\n\tLogin         bool\n\tLoginEmail    string `mapstructure:\"login_email\"`\n\tLoginPassword string `mapstructure:\"login_password\"`\n\tLoginServer   string `mapstructure:\"login_server\"`\n\tLoginUsername string `mapstructure:\"login_username\"`\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewConfig(raws ...interface{}) (*Config, []string, error)\n```\n\n```go\ntype ContainerConfig struct {\n\tImage      string\n\tRunCommand []string\n\tVolumes    map[string]string\n\tPrivileged bool\n}\n```\nContainerConfig is the configuration used to start a container.\n\n```go\ntype DockerDriver struct {\n\tUi  packer.Ui\n\tCtx *interpolate.Context\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (d *DockerDriver) Commit(id string) (string, error)\n```\n\n```go\nfunc (d *DockerDriver) DeleteImage(id string) error\n```\n\n```go\nfunc (d *DockerDriver) Export(id string, dst io.Writer) error\n```\n\n```go\nfunc (d *DockerDriver) IPAddress(id string) (string, error)\n```\n\n```go\nfunc (d *DockerDriver) Import(path string, repo string) (string, error)\n```\n\n```go\nfunc (d *DockerDriver) Login(repo, email, user, pass string) error\n```\n\n```go\nfunc (d *DockerDriver) Logout(repo string) error\n```\n\n```go\nfunc (d *DockerDriver) Pull(image string) error\n```\n\n```go\nfunc (d *DockerDriver) Push(name string) error\n```\n\n```go\nfunc (d *DockerDriver) SaveImage(id string, dst io.Writer) error\n```\n\n```go\nfunc (d *DockerDriver) StartContainer(config *ContainerConfig) (string, error)\n```\n\n```go\nfunc (d *DockerDriver) StopContainer(id string) error\n```\n\n```go\nfunc (d *DockerDriver) TagImage(id string, repo string, force bool) error\n```\n\n```go\nfunc (d *DockerDriver) Verify() error\n```\n\n```go\nfunc (d *DockerDriver) Version() (*version.Version, error)\n```\n\n```go\ntype Driver interface {\n\t// Commit the container to a tag\n\tCommit(id string) (string, error)\n\n\t// Delete an image that is imported into Docker\n\tDeleteImage(id string) error\n\n\t// Export exports the container with the given ID to the given writer.\n\tExport(id string, dst io.Writer) error\n\n\t// Import imports a container from a tar file\n\tImport(path, repo string) (string, error)\n\n\t// IPAddress returns the address of the container that can be used\n\t// for external access.\n\tIPAddress(id string) (string, error)\n\n\t// Login. This will lock the driver from performing another Login\n\t// until Logout is called. Therefore, any users MUST call Logout.\n\tLogin(repo, email, username, password string) error\n\n\t// Logout. This can only be called if Login succeeded.\n\tLogout(repo string) error\n\n\t// Pull should pull down the given image.\n\tPull(image string) error\n\n\t// Push pushes an image to a Docker index/registry.\n\tPush(name string) error\n\n\t// Save an image with the given ID to the given writer.\n\tSaveImage(id string, dst io.Writer) error\n\n\t// StartContainer starts a container and returns the ID for that container,\n\t// along with a potential error.\n\tStartContainer(*ContainerConfig) (string, error)\n\n\t// StopContainer forcibly stops a container.\n\tStopContainer(id string) error\n\n\t// TagImage tags the image with the given ID\n\tTagImage(id string, repo string, force bool) error\n\n\t// Verify verifies that the driver can run\n\tVerify() error\n\n\t// Version reads the Docker version\n\tVersion() (*version.Version, error)\n}\n```\nDriver 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.\n\n```go\ntype ExportArtifact struct {\n\t// contains filtered or unexported fields\n}\n```\nExportArtifact is an Artifact implementation for when a container is exported from docker into a single flat file.\n\n```go\nfunc (*ExportArtifact) BuilderId() string\n```\n\n```go\nfunc (a *ExportArtifact) Destroy() error\n```\n\n```go\nfunc (a *ExportArtifact) Files() []string\n```\n\n```go\nfunc (*ExportArtifact) Id() string\n```\n\n```go\nfunc (a *ExportArtifact) State(name string) interface{}\n```\n\n```go\nfunc (a *ExportArtifact) String() string\n```\n\n```go\ntype ImportArtifact struct {\n\tBuilderIdValue string\n\tDriver         Driver\n\tIdValue        string\n}\n```\nImportArtifact is an Artifact implementation for when a container is exported from docker into a single flat file.\n\n```go\nfunc (a *ImportArtifact) BuilderId() string\n```\n\n```go\nfunc (a *ImportArtifact) Destroy() error\n```\n\n```go\nfunc (*ImportArtifact) Files() []string\n```\n\n```go\nfunc (a *ImportArtifact) Id() string\n```\n\n```go\nfunc (*ImportArtifact) State(name string) interface{}\n```\n\n```go\nfunc (a *ImportArtifact) String() string\n```\n\n```go\ntype MockDriver struct {\n\tCommitCalled      bool\n\tCommitContainerId string\n\tCommitImageId     string\n\tCommitErr         error\n\n\tDeleteImageCalled bool\n\tDeleteImageId     string\n\tDeleteImageErr    error\n\n\tImportCalled bool\n\tImportPath   string\n\tImportRepo   string\n\tImportId     string\n\tImportErr    error\n\n\tIPAddressCalled bool\n\tIPAddressID     string\n\tIPAddressResult string\n\tIPAddressErr    error\n\n\tLoginCalled   bool\n\tLoginEmail    string\n\tLoginUsername string\n\tLoginPassword string\n\tLoginRepo     string\n\tLoginErr      error\n\n\tLogoutCalled bool\n\tLogoutRepo   string\n\tLogoutErr    error\n\n\tPushCalled bool\n\tPushName   string\n\tPushErr    error\n\n\tSaveImageCalled bool\n\tSaveImageId     string\n\tSaveImageReader io.Reader\n\tSaveImageError  error\n\n\tTagImageCalled  bool\n\tTagImageImageId string\n\tTagImageRepo    string\n\tTagImageForce   bool\n\tTagImageErr     error\n\n\tExportReader io.Reader\n\tExportError  error\n\tPullError    error\n\tStartID      string\n\tStartError   error\n\tStopError    error\n\tVerifyError  error\n\n\tExportCalled bool\n\tExportID     string\n\tPullCalled   bool\n\tPullImage    string\n\tStartCalled  bool\n\tStartConfig  *ContainerConfig\n\tStopCalled   bool\n\tStopID       string\n\tVerifyCalled bool\n\n\tVersionCalled  bool\n\tVersionVersion string\n}\n```\nMockDriver is a driver implementation that can be used for tests.\n\n```go\nfunc (d *MockDriver) Commit(id string) (string, error)\n```\n\n```go\nfunc (d *MockDriver) DeleteImage(id string) error\n```\n\n```go\nfunc (d *MockDriver) Export(id string, dst io.Writer) error\n```\n\n```go\nfunc (d *MockDriver) IPAddress(id string) (string, error)\n```\n\n```go\nfunc (d *MockDriver) Import(path, repo string) (string, error)\n```\n\n```go\nfunc (d *MockDriver) Login(r, e, u, p string) error\n```\n\n```go\nfunc (d *MockDriver) Logout(r string) error\n```\n\n```go\nfunc (d *MockDriver) Pull(image string) error\n```\n\n```go\nfunc (d *MockDriver) Push(name string) error\n```\n\n```go\nfunc (d *MockDriver) SaveImage(id string, dst io.Writer) error\n```\n\n```go\nfunc (d *MockDriver) StartContainer(config *ContainerConfig) (string, error)\n```\n\n```go\nfunc (d *MockDriver) StopContainer(id string) error\n```\n\n```go\nfunc (d *MockDriver) TagImage(id string, repo string, force bool) error\n```\n\n```go\nfunc (d *MockDriver) Verify() error\n```\n\n```go\nfunc (d *MockDriver) Version() (*version.Version, error)\n```\n\n```go\ntype StepCommit struct {\n\t// contains filtered or unexported fields\n}\n```\nStepCommit commits the container to a image.\n\n```go\nfunc (s *StepCommit) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepCommit) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepConnectDocker struct{}\n```\n\n```go\nfunc (s *StepConnectDocker) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepConnectDocker) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepExport struct{}\n```\nStepExport exports the container to a flat tar file.\n\n```go\nfunc (s *StepExport) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepExport) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepPull struct{}\n```\n\n```go\nfunc (s *StepPull) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepPull) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepRun struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (s *StepRun) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepRun) Run(state multistep.StateBag) multistep.StepAction\n```\n\n```go\ntype StepTempDir struct {\n\t// contains filtered or unexported fields\n}\n```\nStepTempDir creates a temporary directory that we use in order to share data with the docker container over the communicator.\n\n```go\nfunc (s *StepTempDir) Cleanup(state multistep.StateBag)\n```\n\n```go\nfunc (s *StepTempDir) Run(state multistep.StateBag) multistep.StepAction\n```\n\n","path":"github.com/stackpointcloud/packer/builder/docker","name":"docker","synopsis":"","isRedistributable":true}
