Documentation ¶
Index ¶
- Constants
- type AwsAccessConfig
- type Builder
- type Communicator
- func (c *Communicator) Download(src string, dst io.Writer) error
- func (c *Communicator) DownloadDir(src string, dst string, exclude []string) error
- func (c *Communicator) Start(remote *packer.RemoteCmd) error
- func (c *Communicator) Upload(dst string, src io.Reader, fi *os.FileInfo) error
- func (c *Communicator) UploadDir(dst string, src string, exclude []string) error
- type Config
- type ContainerConfig
- type DockerDriver
- func (d *DockerDriver) Commit(id string, author string, changes []string, message string) (string, error)
- func (d *DockerDriver) DeleteImage(id string) error
- func (d *DockerDriver) Export(id string, dst io.Writer) error
- func (d *DockerDriver) IPAddress(id string) (string, error)
- func (d *DockerDriver) Import(path string, repo string) (string, error)
- func (d *DockerDriver) Login(repo, user, pass string) error
- func (d *DockerDriver) Logout(repo string) error
- func (d *DockerDriver) Pull(image string) error
- func (d *DockerDriver) Push(name string) error
- func (d *DockerDriver) SaveImage(id string, dst io.Writer) error
- func (d *DockerDriver) StartContainer(config *ContainerConfig) (string, error)
- func (d *DockerDriver) StopContainer(id string) error
- func (d *DockerDriver) TagImage(id string, repo string, force bool) error
- func (d *DockerDriver) Verify() error
- func (d *DockerDriver) Version() (*version.Version, error)
- type Driver
- type ExportArtifact
- type ImportArtifact
- type MockDriver
- func (d *MockDriver) Commit(id string, author string, changes []string, message string) (string, error)
- func (d *MockDriver) DeleteImage(id string) error
- func (d *MockDriver) Export(id string, dst io.Writer) error
- func (d *MockDriver) IPAddress(id string) (string, error)
- func (d *MockDriver) Import(path, repo string) (string, error)
- func (d *MockDriver) Login(r, u, p string) error
- func (d *MockDriver) Logout(r string) error
- func (d *MockDriver) Pull(image string) error
- func (d *MockDriver) Push(name string) error
- func (d *MockDriver) SaveImage(id string, dst io.Writer) error
- func (d *MockDriver) StartContainer(config *ContainerConfig) (string, error)
- func (d *MockDriver) StopContainer(id string) error
- func (d *MockDriver) TagImage(id string, repo string, force bool) error
- func (d *MockDriver) Verify() error
- func (d *MockDriver) Version() (*version.Version, error)
- type StepCommit
- type StepConnectDocker
- type StepExport
- type StepPull
- type StepRun
- type StepTempDir
Constants ¶
const ( BuilderId = "packer.docker" BuilderIdImport = "packer.post-processor.docker-import" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AwsAccessConfig ¶ added in v0.11.0
type AwsAccessConfig struct { AccessKey string `mapstructure:"aws_access_key"` SecretKey string `mapstructure:"aws_secret_key"` Token string `mapstructure:"aws_token"` Profile string `mapstructure:"aws_profile"` // contains filtered or unexported fields }
func (*AwsAccessConfig) EcrGetLogin ¶ added in v0.11.0
func (c *AwsAccessConfig) EcrGetLogin(ecrUrl string) (string, string, error)
Get a login token for Amazon AWS ECR. Returns username and password or an error.
type Communicator ¶
type Communicator struct { ContainerID string HostDir string ContainerDir string Version *version.Version Config *Config ContainerUser string // contains filtered or unexported fields }
func (*Communicator) Download ¶
func (c *Communicator) Download(src string, dst io.Writer) error
Download 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.
func (*Communicator) DownloadDir ¶ added in v0.9.0
func (c *Communicator) DownloadDir(src string, dst string, exclude []string) error
type Config ¶
type Config struct { common.PackerConfig `mapstructure:",squash"` Comm communicator.Config `mapstructure:",squash"` Author string Changes []string Commit bool ContainerDir string `mapstructure:"container_dir"` Discard bool ExecUser string `mapstructure:"exec_user"` ExportPath string `mapstructure:"export_path"` Image string Message string Privileged bool `mapstructure:"privileged"` Pty bool Pull bool RunCommand []string `mapstructure:"run_command"` Volumes map[string]string FixUploadOwner bool `mapstructure:"fix_upload_owner"` // This is used to login to dockerhub to pull a private base container. For // pushing to dockerhub, see the docker post-processors Login bool LoginPassword string `mapstructure:"login_password"` LoginServer string `mapstructure:"login_server"` LoginUsername string `mapstructure:"login_username"` EcrLogin bool `mapstructure:"ecr_login"` AwsAccessConfig `mapstructure:",squash"` // contains filtered or unexported fields }
type ContainerConfig ¶
type ContainerConfig struct { Image string RunCommand []string Volumes map[string]string Privileged bool }
ContainerConfig is the configuration used to start a container.
type DockerDriver ¶
type DockerDriver struct { Ui packer.Ui Ctx *interpolate.Context // contains filtered or unexported fields }
func (*DockerDriver) DeleteImage ¶ added in v0.5.2
func (d *DockerDriver) DeleteImage(id string) error
func (*DockerDriver) IPAddress ¶ added in v0.8.0
func (d *DockerDriver) IPAddress(id string) (string, error)
func (*DockerDriver) Import ¶ added in v0.5.2
func (d *DockerDriver) Import(path string, repo string) (string, error)
func (*DockerDriver) Login ¶ added in v0.7.0
func (d *DockerDriver) Login(repo, user, pass string) error
func (*DockerDriver) Logout ¶ added in v0.7.0
func (d *DockerDriver) Logout(repo string) error
func (*DockerDriver) Pull ¶
func (d *DockerDriver) Pull(image string) error
func (*DockerDriver) Push ¶ added in v0.5.2
func (d *DockerDriver) Push(name string) error
func (*DockerDriver) SaveImage ¶ added in v0.7.0
func (d *DockerDriver) SaveImage(id string, dst io.Writer) error
func (*DockerDriver) StartContainer ¶
func (d *DockerDriver) StartContainer(config *ContainerConfig) (string, error)
func (*DockerDriver) StopContainer ¶
func (d *DockerDriver) StopContainer(id string) error
func (*DockerDriver) TagImage ¶ added in v0.7.0
func (d *DockerDriver) TagImage(id string, repo string, force bool) error
func (*DockerDriver) Verify ¶
func (d *DockerDriver) Verify() error
func (*DockerDriver) Version ¶ added in v0.8.0
func (d *DockerDriver) Version() (*version.Version, error)
type Driver ¶
type Driver interface { // Commit the container to a tag Commit(id string, author string, changes []string, message string) (string, error) // Delete an image that is imported into Docker DeleteImage(id string) error // Export exports the container with the given ID to the given writer. Export(id string, dst io.Writer) error // Import imports a container from a tar file Import(path, repo string) (string, error) // IPAddress returns the address of the container that can be used // for external access. IPAddress(id string) (string, error) // Login. This will lock the driver from performing another Login // until Logout is called. Therefore, any users MUST call Logout. Login(repo, username, password string) error // Logout. This can only be called if Login succeeded. Logout(repo string) error // Pull should pull down the given image. Pull(image string) error // Push pushes an image to a Docker index/registry. Push(name string) error // Save an image with the given ID to the given writer. SaveImage(id string, dst io.Writer) error // 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 // TagImage tags the image with the given ID TagImage(id string, repo string, force bool) error // Verify verifies that the driver can run Verify() error // Version reads the Docker version Version() (*version.Version, error) }
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 ExportArtifact ¶
type ExportArtifact struct {
// contains filtered or unexported fields
}
ExportArtifact is an Artifact implementation for when a container is exported from docker into a single flat file.
func (*ExportArtifact) BuilderId ¶
func (*ExportArtifact) BuilderId() string
func (*ExportArtifact) Destroy ¶
func (a *ExportArtifact) Destroy() error
func (*ExportArtifact) Files ¶
func (a *ExportArtifact) Files() []string
func (*ExportArtifact) Id ¶
func (*ExportArtifact) Id() string
func (*ExportArtifact) State ¶ added in v0.7.2
func (a *ExportArtifact) State(name string) interface{}
func (*ExportArtifact) String ¶
func (a *ExportArtifact) String() string
type ImportArtifact ¶ added in v0.5.2
ImportArtifact is an Artifact implementation for when a container is exported from docker into a single flat file.
func (*ImportArtifact) BuilderId ¶ added in v0.5.2
func (a *ImportArtifact) BuilderId() string
func (*ImportArtifact) Destroy ¶ added in v0.5.2
func (a *ImportArtifact) Destroy() error
func (*ImportArtifact) Files ¶ added in v0.5.2
func (*ImportArtifact) Files() []string
func (*ImportArtifact) Id ¶ added in v0.5.2
func (a *ImportArtifact) Id() string
func (*ImportArtifact) State ¶ added in v0.7.2
func (*ImportArtifact) State(name string) interface{}
func (*ImportArtifact) String ¶ added in v0.5.2
func (a *ImportArtifact) String() string
type MockDriver ¶
type MockDriver struct { CommitCalled bool CommitContainerId string CommitImageId string CommitErr error DeleteImageCalled bool DeleteImageId string DeleteImageErr error ImportCalled bool ImportPath string ImportRepo string ImportId string ImportErr error IPAddressCalled bool IPAddressID string IPAddressResult string IPAddressErr error LoginCalled bool LoginUsername string LoginPassword string LoginRepo string LoginErr error LogoutCalled bool LogoutRepo string LogoutErr error PushCalled bool PushName string PushErr error SaveImageCalled bool SaveImageId string SaveImageReader io.Reader SaveImageError error TagImageCalled bool TagImageImageId string TagImageRepo string TagImageForce bool TagImageErr error ExportReader io.Reader ExportError error PullError error StartID string StartError error StopError error VerifyError error ExportCalled bool ExportID string PullCalled bool PullImage string StartCalled bool StartConfig *ContainerConfig StopCalled bool StopID string VerifyCalled bool VersionCalled bool VersionVersion string }
MockDriver is a driver implementation that can be used for tests.
func (*MockDriver) DeleteImage ¶ added in v0.5.2
func (d *MockDriver) DeleteImage(id string) error
func (*MockDriver) IPAddress ¶ added in v0.8.0
func (d *MockDriver) IPAddress(id string) (string, error)
func (*MockDriver) Import ¶ added in v0.5.2
func (d *MockDriver) Import(path, repo string) (string, error)
func (*MockDriver) Login ¶ added in v0.7.0
func (d *MockDriver) Login(r, u, p string) error
func (*MockDriver) Logout ¶ added in v0.7.0
func (d *MockDriver) Logout(r string) error
func (*MockDriver) Pull ¶
func (d *MockDriver) Pull(image string) error
func (*MockDriver) Push ¶ added in v0.5.2
func (d *MockDriver) Push(name string) error
func (*MockDriver) SaveImage ¶ added in v0.7.0
func (d *MockDriver) SaveImage(id string, dst io.Writer) error
func (*MockDriver) StartContainer ¶
func (d *MockDriver) StartContainer(config *ContainerConfig) (string, error)
func (*MockDriver) StopContainer ¶
func (d *MockDriver) StopContainer(id string) error
func (*MockDriver) TagImage ¶ added in v0.7.0
func (d *MockDriver) TagImage(id string, repo string, force bool) error
func (*MockDriver) Verify ¶
func (d *MockDriver) Verify() error
func (*MockDriver) Version ¶ added in v0.8.0
func (d *MockDriver) Version() (*version.Version, error)
type StepCommit ¶ added in v0.7.0
type StepCommit struct {
// contains filtered or unexported fields
}
StepCommit commits the container to a image.
func (*StepCommit) Cleanup ¶ added in v0.7.0
func (s *StepCommit) Cleanup(state multistep.StateBag)
func (*StepCommit) Run ¶ added in v0.7.0
func (s *StepCommit) Run(state multistep.StateBag) multistep.StepAction
type StepConnectDocker ¶ added in v0.8.0
type StepConnectDocker struct{}
func (*StepConnectDocker) Cleanup ¶ added in v0.8.0
func (s *StepConnectDocker) Cleanup(state multistep.StateBag)
func (*StepConnectDocker) Run ¶ added in v0.8.0
func (s *StepConnectDocker) Run(state multistep.StateBag) multistep.StepAction
type StepExport ¶
type StepExport struct{}
StepExport exports the container to a flat tar file.
func (*StepExport) Cleanup ¶
func (s *StepExport) Cleanup(state multistep.StateBag)
func (*StepExport) Run ¶
func (s *StepExport) Run(state multistep.StateBag) multistep.StepAction
type StepTempDir ¶
type StepTempDir struct {
// contains filtered or unexported fields
}
StepTempDir creates a temporary directory that we use in order to share data with the docker container over the communicator.
func (*StepTempDir) Cleanup ¶
func (s *StepTempDir) Cleanup(state multistep.StateBag)
func (*StepTempDir) Run ¶
func (s *StepTempDir) Run(state multistep.StateBag) multistep.StepAction