Documentation ¶
Index ¶
- Constants
- func ConfigTmpDir() (string, error)
- type AwsAccessConfig
- func (c *AwsAccessConfig) EcrGetLogin(ecrUrl string) (string, string, error)
- func (*AwsAccessConfig) FlatMapstructure() interface{ ... }
- func (c *AwsAccessConfig) GetCredentials(config *aws.Config) (*awsCredentials.Credentials, error)
- func (c *AwsAccessConfig) PublicEcrLogin(ecrUrl string) (string, string, error)
- func (c *AwsAccessConfig) SetPublicEcrGallery(ecrUrl string)
- 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(ctx context.Context, remote *packersdk.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) Build(args []string) (string, error)
- func (d *DockerDriver) Cmd(id string) (string, error)
- func (d *DockerDriver) Commit(id string, author string, changes []string, message string) (string, error)
- func (d *DockerDriver) DeleteImage(id string) error
- func (d *DockerDriver) Digest(id string) (string, error)
- func (d *DockerDriver) Entrypoint(id string) (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, changes []string, repo string, platform string) (string, error)
- func (d *DockerDriver) KillContainer(id string) error
- func (d *DockerDriver) Login(repo, user, pass string) error
- func (d *DockerDriver) Logout(repo string) error
- func (d *DockerDriver) Pull(image string, platform string) error
- func (d *DockerDriver) Push(name string, platform string) error
- func (d *DockerDriver) SaveImage(id string, dst io.Writer) error
- func (d *DockerDriver) Sha256(id string) (string, 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 DockerfileBootstrapConfig
- type Driver
- type ECRType
- type ExportArtifact
- type FlatAwsAccessConfig
- type FlatConfig
- type FlatDockerfileBootstrapConfig
- type ImportArtifact
- type MockDriver
- func (d *MockDriver) Build(args []string) (string, error)
- func (d *MockDriver) Commit(id string, author string, changes []string, message string) (string, error)
- func (d *MockDriver) DeleteImage(id string) error
- func (d *MockDriver) Digest(id string) (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 string, changes []string, repo string, platform string) (string, error)
- func (d *MockDriver) KillContainer(id string) error
- func (d *MockDriver) Login(r, u, p string) error
- func (d *MockDriver) Logout(r string) error
- func (d *MockDriver) Pull(image string, platform string) error
- func (d *MockDriver) Push(name string, platform string) error
- func (d *MockDriver) SaveImage(id string, dst io.Writer) error
- func (d *MockDriver) Sha256(id string) (string, 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 StepDefaultGeneratedData
- type StepExport
- type StepPull
- type StepRun
- type StepSetDefaults
- type StepTempDir
- type WindowsContainerCommunicator
Constants ¶
const ( BuilderId = "packer.docker" BuilderIdImport = "packer.post-processor.docker-import" )
const EcrPublicApiRegion = "us-east-1"
EcrPublicApiRegion : The Amazon ECR Public registry requires authentication in the us-east-1 Region, so you need to specify --region us-east-1 each time you authenticate
const EcrPublicHost = "public.ecr.aws/"
Variables ¶
This section is empty.
Functions ¶
func ConfigTmpDir ¶
ConfigTmpDir returns the configuration tmp directory for Docker
Types ¶
type AwsAccessConfig ¶
type AwsAccessConfig struct { // The AWS access key used to communicate with AWS. AccessKey string `mapstructure:"aws_access_key" required:"false"` // The AWS secret key used to communicate with AWS. SecretKey string `mapstructure:"aws_secret_key" required:"false"` // The AWS access token to use. This is different from // the access key and secret key. If you're not sure what this is, then you // probably don't need it. This will also be read from the AWS_SESSION_TOKEN // environmental variable. Token string `mapstructure:"aws_token" required:"false"` // The AWS shared credentials profile used to communicate with AWS. Profile string `mapstructure:"aws_profile" required:"false"` // The flag to identify whether to push docker image to Public _or_ Private // ECR. If the user sets this to `true` from the config, we will forcefully // try to push to Public ECR otherwise set this from code based on the // given LoginServer value. PublicEcrGallery bool `mapstructure:"aws_force_use_public_ecr" required:"false"` }
func (*AwsAccessConfig) EcrGetLogin ¶
func (c *AwsAccessConfig) EcrGetLogin(ecrUrl string) (string, string, error)
EcrGetLogin Get a login token for Amazon AWS ECR. Returns username and password or an error.
func (*AwsAccessConfig) FlatMapstructure ¶ added in v1.1.0
func (*AwsAccessConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatAwsAccessConfig. FlatAwsAccessConfig is an auto-generated flat version of AwsAccessConfig. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
func (*AwsAccessConfig) GetCredentials ¶
func (c *AwsAccessConfig) GetCredentials(config *aws.Config) (*awsCredentials.Credentials, error)
GetCredentials gets credentials from the environment, shared credentials, the session (which may include a credential process), or ECS/EC2 metadata endpoints. GetCredentials also validates the credentials and the ability to assume a role or will return an error if unsuccessful.
func (*AwsAccessConfig) PublicEcrLogin ¶ added in v1.0.7
func (c *AwsAccessConfig) PublicEcrLogin(ecrUrl string) (string, string, error)
PublicEcrLogin : Get a login token for Amazon AWS ECR Public. Returns username and password or an error.
func (*AwsAccessConfig) SetPublicEcrGallery ¶ added in v1.0.8
func (c *AwsAccessConfig) SetPublicEcrGallery(ecrUrl string)
SetPublicEcrGallery sets PublicEcrGallery flag to `true` if the user given LoginServer is the ECR Public URL
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func (*Builder) ConfigSpec ¶
func (b *Builder) ConfigSpec() hcldec.ObjectSpec
type Communicator ¶
type Communicator struct { Executable string ContainerID string HostDir string ContainerDir string Version *version.Version Config *Config ContainerUser string EntryPoint []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 ¶
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"` // Configuration for a bootstrap image derived from a Dockerfile // // Specifying this will make the builder run `docker build` on a provided // Dockerfile, and this image will then be used to perform the rest of // the build process. // // For more information on the contents of this object, refer to the // [Bootstrapping a build with a Dockerfile](#bootstrapping-a-build-with-a-dockerfile) // section of this documentation. BuildConfig DockerfileBootstrapConfig `mapstructure:"build"` // Set the author (e-mail) of a commit. Author string `mapstructure:"author"` // Dockerfile instructions to add to the commit. Example of instructions // are CMD, ENTRYPOINT, ENV, and EXPOSE. Example: [ "USER ubuntu", "WORKDIR // /app", "EXPOSE 8080" ] Changes []string `mapstructure:"changes"` // If true, the container will be committed to an image rather than exported. // Default `false`. If `commit` is `false`, then either `discard` must be // set to `true` or an `export_path` must be provided. Commit bool `mapstructure:"commit" required:"true"` // The directory inside container to mount temp directory from host server // for work [file provisioner](/packer/docs/provisioners/file). This defaults // to c:/packer-files on windows and /packer-files on other systems. ContainerDir string `mapstructure:"container_dir" required:"false"` // An array of devices which will be accessible in container when it's run // without `--privileged` flag. Device []string `mapstructure:"device" required:"false"` // Throw away the container when the build is complete. This is useful for // the [artifice // post-processor](/packer/docs/post-processors/artifice). Discard bool `mapstructure:"discard" required:"true"` // An array of additional [Linux // capabilities](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) // to grant to the container. CapAdd []string `mapstructure:"cap_add" required:"false"` // An array of [Linux // capabilities](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities) // to drop from the container. CapDrop []string `mapstructure:"cap_drop" required:"false"` // Sets the docker binary to use for running commands. // // If you want to use a specific version of the docker binary, or a // docker alternative for building your container, you can specify this // through this option. // **Note**: if using an alternative like `podman`, not all options are // equivalent, and the build may fail in this case. // // Defaults to "docker" Executable string `mapstructure:"docker_path"` // Username (UID) to run remote commands with. You can also set the group // name/ID if you want: (UID or UID:GID). You may need this if you get // permission errors trying to run the shell or other provisioners. ExecUser string `mapstructure:"exec_user" required:"false"` // The path where the final container will be exported as a tar file. ExportPath string `mapstructure:"export_path" required:"true"` // The base image for the Docker container that will be started. This image // will be pulled from the Docker registry if it doesn't already exist. // Any value format that you can provide to `docker pull` is valid. // Example: `ubuntu` or `ubuntu:xenial`. If you only provide the repo, Docker // will pull the latest image, so setting `ubuntu` is the same as setting // `ubuntu:latest`. You can also set a distribution digest. For example, // ubuntu@sha256:a0d9e826ab87bd665cfc640598a871b748b4b70a01a4f3d174d4fb02adad07a9 // // This cannot be used at the same time as `build` Image string `mapstructure:"image" required:"false"` // Set a message for the commit. Message string `mapstructure:"message" required:"true"` // If true, run the docker container with the `--privileged` flag. This // defaults to false if not set. Privileged bool `mapstructure:"privileged" required:"false"` Pty bool // Set the container runtime. A runtime different from the one installed // by default with Docker (`runc`) must be installed and configured. // The possible values are (non-exhaustive list): // `runsc` for [gVisor](https://gvisor.dev/), // `kata-runtime` for [Kata Containers](https://katacontainers.io/), // `sysbox-runc` for [Nestybox](https://www.nestybox.com/). Runtime string `mapstructure:"runtime" required:"false"` // If true, the configured image will be pulled using `docker pull` prior // to use. Otherwise, it is assumed the image already exists and can be // used. This defaults to true if not set. // // If using `build`, this field will be ignored, as the `pull` option for // this operation will instead have precedence. Pull bool `mapstructure:"pull" required:"false"` // An array of arguments to pass to docker run in order to run the // container. By default this is set to `["-d", "-i", "-t", // "--entrypoint=/bin/sh", "--", "{{.Image}}"]` if you are using a linux // container, and `["-d", "-i", "-t", "--entrypoint=powershell", "--", // "{{.Image}}"]` if you are running a windows container. `{{.Image}}` is a // template variable that corresponds to the image template option. Passing // the entrypoint option this way will make it the default entrypoint of // the resulting image, so running docker run -it --rm will start the // docker image from the /bin/sh shell interpreter; you could run a script // or another shell by running docker run -it --rm -c /bin/bash. If your // docker image embeds a binary intended to be run often, you should // consider changing the default entrypoint to point to it. RunCommand []string `mapstructure:"run_command" required:"false"` // An array of additional tmpfs volumes to mount into this container. TmpFs []string `mapstructure:"tmpfs" required:"false"` // A mapping of additional volumes to mount into this container. The key of // the object is the host path, the value is the container path. Volumes map[string]string `mapstructure:"volumes" required:"false"` // If true, files uploaded to the container will be owned by the user the // container is running as. If false, the owner will depend on the version // of docker installed in the system. Defaults to true. FixUploadOwner bool `mapstructure:"fix_upload_owner" required:"false"` // If "true", tells Packer that you are building a Windows container // running on a windows host. This is necessary for building Windows // containers, because our normal docker bindings do not work for them. WindowsContainer bool `mapstructure:"windows_container" required:"false"` // Set platform if server is multi-platform capable Platform string `mapstructure:"platform" required:"false"` // This is used to login to a private docker repository (e.g., dockerhub) // to build or pull a private base container. For pushing to a private // repository, see the docker post-processors. Login bool `mapstructure:"login" required:"false"` // The password to use to authenticate to login. LoginPassword string `mapstructure:"login_password" required:"false"` // The server address to login to. LoginServer string `mapstructure:"login_server" required:"false"` // The username to use to authenticate to login. LoginUsername string `mapstructure:"login_username" required:"false"` // Defaults to false. If true, the builder will login in order to build or // pull the image from Amazon EC2 Container Registry (ECR). The builder // only logs in for the duration of the build or pull step. If true, // login_server is required and login, login_username, and login_password // will be ignored. For more information see the section on ECR. EcrLogin bool `mapstructure:"ecr_login" required:"false"` AwsAccessConfig `mapstructure:",squash"` // contains filtered or unexported fields }
func (*Config) FlatMapstructure ¶
FlatMapstructure returns a new FlatConfig. FlatConfig is an auto-generated flat version of Config. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
type ContainerConfig ¶
type ContainerConfig struct { Image string RunCommand []string Device []string CapAdd []string CapDrop []string Volumes map[string]string TmpFs []string Privileged bool Runtime string Platform string }
ContainerConfig is the configuration used to start a container.
type DockerDriver ¶
type DockerDriver struct { Ui packersdk.Ui Ctx *interpolate.Context // The directory Docker should use to store its client configuration. // Provides an isolated client configuration to each Docker operation to // prevent race conditions. ConfigDir string // The executable to run commands with. Executable string // contains filtered or unexported fields }
func (*DockerDriver) Build ¶ added in v1.1.0
func (d *DockerDriver) Build(args []string) (string, error)
func (*DockerDriver) DeleteImage ¶
func (d *DockerDriver) DeleteImage(id string) error
func (*DockerDriver) Digest ¶
func (d *DockerDriver) Digest(id string) (string, error)
Digest retrieves the digest of the image using Docker inspect. Format for the digest is: <repo>@sha256:<shasum> For example: ubuntu@sha256:454054f5bbd571b088db25b662099c6c7b3f0cb78536a2077d54adc48f00cd68 This can be considered a source of truth for pointing to a specific image at a specific point in time.
func (*DockerDriver) Entrypoint ¶ added in v1.0.9
func (d *DockerDriver) Entrypoint(id string) (string, error)
func (*DockerDriver) KillContainer ¶
func (d *DockerDriver) KillContainer(id string) error
func (*DockerDriver) Login ¶
func (d *DockerDriver) Login(repo, user, pass string) error
func (*DockerDriver) Logout ¶
func (d *DockerDriver) Logout(repo string) error
func (*DockerDriver) Sha256 ¶
func (d *DockerDriver) Sha256(id string) (string, error)
Sha256 retrieves the image Id using Docker inspect.
func (*DockerDriver) StartContainer ¶
func (d *DockerDriver) StartContainer(config *ContainerConfig) (string, error)
func (*DockerDriver) StopContainer ¶
func (d *DockerDriver) StopContainer(id string) error
func (*DockerDriver) TagImage ¶
func (d *DockerDriver) TagImage(id string, repo string, force bool) error
func (*DockerDriver) Verify ¶
func (d *DockerDriver) Verify() error
func (*DockerDriver) Version ¶
func (d *DockerDriver) Version() (*version.Version, error)
type DockerfileBootstrapConfig ¶ added in v1.1.0
type DockerfileBootstrapConfig struct { // Path to the dockerfile to use for building the base image // // If set, the builder will invoke `docker build` on it, and use the // produced image to continue the build afterwards. // // Note: Mutually exclusive with "image" DockerfilePath string `mapstructure:"path" required:"true"` // Directory to invoke `docker build` from // // Defaults to the directory from which we invoke packer. BuildDir string `mapstructure:"build_dir"` // A mapping of additional build args to provide. The key of // the object is the argument name, the value is the argument value. Arguments map[string]string `mapstructure:"arguments" required:"false"` // Inherited from the global configuration: set platform if server is multi-platform capable Platform string `mapstructure-to-hcl2:",skip"` // Pull the image when building the base docker image. // // Note: defaults to true, to disable this, explicitly set it to false. Pull config.Trilean `mapstructure:"pull"` // Compress the build context before sending to the docker daemon. // // This is especially useful if the build context is large, as copying it // can take a significant amount of time, while once compressed, this // can make builds faster, at the price of extra CPU resources. Compress bool `mapstructure:"compress"` }
DockerfileBootstrapConfig is the configuration for bootstrapping a docker builder with a user-provided Dockerfile.
If used, the builder will build a source image locally using `docker build`, and continue the build normally with this as the base image.
func (DockerfileBootstrapConfig) BuildArgs ¶ added in v1.1.0
func (c DockerfileBootstrapConfig) BuildArgs() []string
BuildArgs returns the list of arguments to pass to docker build.
func (*DockerfileBootstrapConfig) FlatMapstructure ¶ added in v1.1.0
func (*DockerfileBootstrapConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatDockerfileBootstrapConfig. FlatDockerfileBootstrapConfig is an auto-generated flat version of DockerfileBootstrapConfig. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
func (DockerfileBootstrapConfig) IsDefault ¶ added in v1.1.0
func (c DockerfileBootstrapConfig) IsDefault() bool
IsDefault returns whether the DockerfileBootstrapConfig is the empty one or not
func (*DockerfileBootstrapConfig) Prepare ¶ added in v1.1.0
func (c *DockerfileBootstrapConfig) Prepare() ([]string, error)
type Driver ¶
type Driver interface { // Build runs `docker build` on a Dockerfile // // args is meant to be populated from the config's // `DockerfileBootstrapConfig.BuildArgs` function. Build(args []string) (string, error) // 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 string, changes []string, repo string, platform string) (string, error) // IPAddress returns the address of the container that can be used // for external access. IPAddress(id string) (string, error) // Sha256 returns the sha256 id of the image Sha256(id string) (string, error) // Retrieve the repo digest of the image. Digest(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, platform string) error // Push pushes an image to a Docker index/registry. Push(name string, platform 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) // KillContainer forcibly stops a container. KillContainer(id string) error // StopContainer gently 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 { // StateData should store data such as GeneratedData // to be shared with post-processors StateData map[string]interface{} // 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 ¶
func (a *ExportArtifact) State(name string) interface{}
func (*ExportArtifact) String ¶
func (a *ExportArtifact) String() string
type FlatAwsAccessConfig ¶ added in v1.1.0
type FlatAwsAccessConfig struct { AccessKey *string `mapstructure:"aws_access_key" required:"false" cty:"aws_access_key" hcl:"aws_access_key"` SecretKey *string `mapstructure:"aws_secret_key" required:"false" cty:"aws_secret_key" hcl:"aws_secret_key"` Token *string `mapstructure:"aws_token" required:"false" cty:"aws_token" hcl:"aws_token"` Profile *string `mapstructure:"aws_profile" required:"false" cty:"aws_profile" hcl:"aws_profile"` PublicEcrGallery *bool `mapstructure:"aws_force_use_public_ecr" required:"false" cty:"aws_force_use_public_ecr" hcl:"aws_force_use_public_ecr"` }
FlatAwsAccessConfig is an auto-generated flat version of AwsAccessConfig. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatAwsAccessConfig) HCL2Spec ¶ added in v1.1.0
func (*FlatAwsAccessConfig) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a AwsAccessConfig. This spec is used by HCL to read the fields of AwsAccessConfig. The decoded values from this spec will then be applied to a FlatAwsAccessConfig.
type FlatConfig ¶
type FlatConfig struct { PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name" hcl:"packer_build_name"` PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"` PackerCoreVersion *string `mapstructure:"packer_core_version" cty:"packer_core_version" hcl:"packer_core_version"` PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"` PackerForce *bool `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"` PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"` PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"` PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"` Type *string `mapstructure:"communicator" cty:"communicator" hcl:"communicator"` PauseBeforeConnect *string `mapstructure:"pause_before_connecting" cty:"pause_before_connecting" hcl:"pause_before_connecting"` SSHHost *string `mapstructure:"ssh_host" cty:"ssh_host" hcl:"ssh_host"` SSHPort *int `mapstructure:"ssh_port" cty:"ssh_port" hcl:"ssh_port"` SSHUsername *string `mapstructure:"ssh_username" cty:"ssh_username" hcl:"ssh_username"` SSHPassword *string `mapstructure:"ssh_password" cty:"ssh_password" hcl:"ssh_password"` SSHKeyPairName *string `mapstructure:"ssh_keypair_name" undocumented:"true" cty:"ssh_keypair_name" hcl:"ssh_keypair_name"` SSHTemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" undocumented:"true" cty:"temporary_key_pair_name" hcl:"temporary_key_pair_name"` SSHTemporaryKeyPairType *string `mapstructure:"temporary_key_pair_type" cty:"temporary_key_pair_type" hcl:"temporary_key_pair_type"` SSHTemporaryKeyPairBits *int `mapstructure:"temporary_key_pair_bits" cty:"temporary_key_pair_bits" hcl:"temporary_key_pair_bits"` SSHCiphers []string `mapstructure:"ssh_ciphers" cty:"ssh_ciphers" hcl:"ssh_ciphers"` SSHClearAuthorizedKeys *bool `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys" hcl:"ssh_clear_authorized_keys"` SSHKEXAlgos []string `mapstructure:"ssh_key_exchange_algorithms" cty:"ssh_key_exchange_algorithms" hcl:"ssh_key_exchange_algorithms"` SSHPrivateKeyFile *string `mapstructure:"ssh_private_key_file" undocumented:"true" cty:"ssh_private_key_file" hcl:"ssh_private_key_file"` SSHCertificateFile *string `mapstructure:"ssh_certificate_file" cty:"ssh_certificate_file" hcl:"ssh_certificate_file"` SSHPty *bool `mapstructure:"ssh_pty" cty:"ssh_pty" hcl:"ssh_pty"` SSHTimeout *string `mapstructure:"ssh_timeout" cty:"ssh_timeout" hcl:"ssh_timeout"` SSHWaitTimeout *string `mapstructure:"ssh_wait_timeout" undocumented:"true" cty:"ssh_wait_timeout" hcl:"ssh_wait_timeout"` SSHAgentAuth *bool `mapstructure:"ssh_agent_auth" undocumented:"true" cty:"ssh_agent_auth" hcl:"ssh_agent_auth"` SSHDisableAgentForwarding *bool `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding" hcl:"ssh_disable_agent_forwarding"` SSHHandshakeAttempts *int `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts" hcl:"ssh_handshake_attempts"` SSHBastionHost *string `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host" hcl:"ssh_bastion_host"` SSHBastionPort *int `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port" hcl:"ssh_bastion_port"` SSHBastionAgentAuth *bool `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth" hcl:"ssh_bastion_agent_auth"` SSHBastionUsername *string `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username" hcl:"ssh_bastion_username"` SSHBastionPassword *string `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password" hcl:"ssh_bastion_password"` SSHBastionInteractive *bool `mapstructure:"ssh_bastion_interactive" cty:"ssh_bastion_interactive" hcl:"ssh_bastion_interactive"` SSHBastionPrivateKeyFile *string `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file" hcl:"ssh_bastion_private_key_file"` SSHBastionCertificateFile *string `mapstructure:"ssh_bastion_certificate_file" cty:"ssh_bastion_certificate_file" hcl:"ssh_bastion_certificate_file"` SSHFileTransferMethod *string `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method" hcl:"ssh_file_transfer_method"` SSHProxyHost *string `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host" hcl:"ssh_proxy_host"` SSHProxyPort *int `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port" hcl:"ssh_proxy_port"` SSHProxyUsername *string `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username" hcl:"ssh_proxy_username"` SSHProxyPassword *string `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password" hcl:"ssh_proxy_password"` SSHKeepAliveInterval *string `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval" hcl:"ssh_keep_alive_interval"` SSHReadWriteTimeout *string `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout" hcl:"ssh_read_write_timeout"` SSHRemoteTunnels []string `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels" hcl:"ssh_remote_tunnels"` SSHLocalTunnels []string `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels" hcl:"ssh_local_tunnels"` SSHPublicKey []byte `mapstructure:"ssh_public_key" undocumented:"true" cty:"ssh_public_key" hcl:"ssh_public_key"` SSHPrivateKey []byte `mapstructure:"ssh_private_key" undocumented:"true" cty:"ssh_private_key" hcl:"ssh_private_key"` WinRMUser *string `mapstructure:"winrm_username" cty:"winrm_username" hcl:"winrm_username"` WinRMPassword *string `mapstructure:"winrm_password" cty:"winrm_password" hcl:"winrm_password"` WinRMHost *string `mapstructure:"winrm_host" cty:"winrm_host" hcl:"winrm_host"` WinRMNoProxy *bool `mapstructure:"winrm_no_proxy" cty:"winrm_no_proxy" hcl:"winrm_no_proxy"` WinRMPort *int `mapstructure:"winrm_port" cty:"winrm_port" hcl:"winrm_port"` WinRMTimeout *string `mapstructure:"winrm_timeout" cty:"winrm_timeout" hcl:"winrm_timeout"` WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl" hcl:"winrm_use_ssl"` WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure" hcl:"winrm_insecure"` WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm" hcl:"winrm_use_ntlm"` BuildConfig *FlatDockerfileBootstrapConfig `mapstructure:"build" cty:"build" hcl:"build"` Author *string `mapstructure:"author" cty:"author" hcl:"author"` Changes []string `mapstructure:"changes" cty:"changes" hcl:"changes"` Commit *bool `mapstructure:"commit" required:"true" cty:"commit" hcl:"commit"` ContainerDir *string `mapstructure:"container_dir" required:"false" cty:"container_dir" hcl:"container_dir"` Device []string `mapstructure:"device" required:"false" cty:"device" hcl:"device"` Discard *bool `mapstructure:"discard" required:"true" cty:"discard" hcl:"discard"` CapAdd []string `mapstructure:"cap_add" required:"false" cty:"cap_add" hcl:"cap_add"` CapDrop []string `mapstructure:"cap_drop" required:"false" cty:"cap_drop" hcl:"cap_drop"` Executable *string `mapstructure:"docker_path" cty:"docker_path" hcl:"docker_path"` ExecUser *string `mapstructure:"exec_user" required:"false" cty:"exec_user" hcl:"exec_user"` ExportPath *string `mapstructure:"export_path" required:"true" cty:"export_path" hcl:"export_path"` Image *string `mapstructure:"image" required:"false" cty:"image" hcl:"image"` Message *string `mapstructure:"message" required:"true" cty:"message" hcl:"message"` Privileged *bool `mapstructure:"privileged" required:"false" cty:"privileged" hcl:"privileged"` Pty *bool `cty:"pty" hcl:"pty"` Runtime *string `mapstructure:"runtime" required:"false" cty:"runtime" hcl:"runtime"` Pull *bool `mapstructure:"pull" required:"false" cty:"pull" hcl:"pull"` RunCommand []string `mapstructure:"run_command" required:"false" cty:"run_command" hcl:"run_command"` TmpFs []string `mapstructure:"tmpfs" required:"false" cty:"tmpfs" hcl:"tmpfs"` Volumes map[string]string `mapstructure:"volumes" required:"false" cty:"volumes" hcl:"volumes"` FixUploadOwner *bool `mapstructure:"fix_upload_owner" required:"false" cty:"fix_upload_owner" hcl:"fix_upload_owner"` WindowsContainer *bool `mapstructure:"windows_container" required:"false" cty:"windows_container" hcl:"windows_container"` Platform *string `mapstructure:"platform" required:"false" cty:"platform" hcl:"platform"` Login *bool `mapstructure:"login" required:"false" cty:"login" hcl:"login"` LoginPassword *string `mapstructure:"login_password" required:"false" cty:"login_password" hcl:"login_password"` LoginServer *string `mapstructure:"login_server" required:"false" cty:"login_server" hcl:"login_server"` LoginUsername *string `mapstructure:"login_username" required:"false" cty:"login_username" hcl:"login_username"` EcrLogin *bool `mapstructure:"ecr_login" required:"false" cty:"ecr_login" hcl:"ecr_login"` AccessKey *string `mapstructure:"aws_access_key" required:"false" cty:"aws_access_key" hcl:"aws_access_key"` SecretKey *string `mapstructure:"aws_secret_key" required:"false" cty:"aws_secret_key" hcl:"aws_secret_key"` Token *string `mapstructure:"aws_token" required:"false" cty:"aws_token" hcl:"aws_token"` Profile *string `mapstructure:"aws_profile" required:"false" cty:"aws_profile" hcl:"aws_profile"` PublicEcrGallery *bool `mapstructure:"aws_force_use_public_ecr" required:"false" cty:"aws_force_use_public_ecr" hcl:"aws_force_use_public_ecr"` }
FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatDockerfileBootstrapConfig ¶ added in v1.1.0
type FlatDockerfileBootstrapConfig struct { DockerfilePath *string `mapstructure:"path" required:"true" cty:"path" hcl:"path"` BuildDir *string `mapstructure:"build_dir" cty:"build_dir" hcl:"build_dir"` Arguments map[string]string `mapstructure:"arguments" required:"false" cty:"arguments" hcl:"arguments"` Pull *bool `mapstructure:"pull" cty:"pull" hcl:"pull"` Compress *bool `mapstructure:"compress" cty:"compress" hcl:"compress"` }
FlatDockerfileBootstrapConfig is an auto-generated flat version of DockerfileBootstrapConfig. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatDockerfileBootstrapConfig) HCL2Spec ¶ added in v1.1.0
func (*FlatDockerfileBootstrapConfig) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a DockerfileBootstrapConfig. This spec is used by HCL to read the fields of DockerfileBootstrapConfig. The decoded values from this spec will then be applied to a FlatDockerfileBootstrapConfig.
type ImportArtifact ¶
type ImportArtifact struct { BuilderIdValue string Driver Driver IdValue string // StateData should store data such as GeneratedData // to be shared with post-processors StateData map[string]interface{} }
ImportArtifact is an Artifact implementation for when a container is exported from docker into a single flat file.
func (*ImportArtifact) BuilderId ¶
func (a *ImportArtifact) BuilderId() string
func (*ImportArtifact) Destroy ¶
func (a *ImportArtifact) Destroy() error
func (*ImportArtifact) Files ¶
func (*ImportArtifact) Files() []string
func (*ImportArtifact) Id ¶
func (a *ImportArtifact) Id() string
func (*ImportArtifact) State ¶
func (a *ImportArtifact) State(name string) interface{}
func (*ImportArtifact) String ¶
func (a *ImportArtifact) String() string
type MockDriver ¶
type MockDriver struct { BuildCalled bool BuildImageId string BuildImageError error CommitCalled bool CommitContainerId string CommitImageId string CommitErr error DeleteImageCalled bool DeleteImageId string DeleteImageErr error ImportCalled bool ImportPath string ImportRepo string ImportId string ImportPlatform string ImportErr error IPAddressCalled bool IPAddressID string IPAddressResult string IPAddressErr error Sha256Called bool Sha256Id string Sha256Result string Sha256Err error DigestCalled bool DigestId string DigestResult string DigestErr error KillCalled bool KillID string KillError error LoginCalled bool LoginUsername string LoginPassword string LoginRepo string LoginErr error LogoutCalled bool LogoutRepo string LogoutErr error PushCalled bool PushName string PushPlatform string PushErr error SaveImageCalled bool SaveImageId string SaveImageReader io.Reader SaveImageError error TagImageCalled int 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 PullPlatform 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) Build ¶ added in v1.1.0
func (d *MockDriver) Build(args []string) (string, error)
func (*MockDriver) DeleteImage ¶
func (d *MockDriver) DeleteImage(id string) error
func (*MockDriver) KillContainer ¶
func (d *MockDriver) KillContainer(id string) error
func (*MockDriver) Login ¶
func (d *MockDriver) Login(r, u, p string) error
func (*MockDriver) Logout ¶
func (d *MockDriver) Logout(r string) 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 ¶
func (d *MockDriver) TagImage(id string, repo string, force bool) error
func (*MockDriver) Verify ¶
func (d *MockDriver) Verify() error
func (*MockDriver) Version ¶
func (d *MockDriver) Version() (*version.Version, error)
type StepCommit ¶
type StepCommit struct { GeneratedData *packerbuilderdata.GeneratedData // contains filtered or unexported fields }
StepCommit commits the container to a image.
func (*StepCommit) Cleanup ¶
func (s *StepCommit) Cleanup(state multistep.StateBag)
func (*StepCommit) Run ¶
func (s *StepCommit) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepConnectDocker ¶
type StepConnectDocker struct{}
func (*StepConnectDocker) Cleanup ¶
func (s *StepConnectDocker) Cleanup(state multistep.StateBag)
func (*StepConnectDocker) Run ¶
func (s *StepConnectDocker) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepDefaultGeneratedData ¶
type StepDefaultGeneratedData struct {
GeneratedData *packerbuilderdata.GeneratedData
}
StepDefaultGeneratedData Adds the placeholders for special generated values that Docker is expected to return. This makes sure that the accessor has _something_ to read in the provisioners, regardless of whether the value. was created. The true values are put in generated data in the steps where the values are actually created (step pull, and step commit)
func (*StepDefaultGeneratedData) Cleanup ¶
func (s *StepDefaultGeneratedData) Cleanup(_ multistep.StateBag)
func (*StepDefaultGeneratedData) Run ¶
func (s *StepDefaultGeneratedData) Run(_ context.Context, 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(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepPull ¶
type StepPull struct { GeneratedData *packerbuilderdata.GeneratedData // contains filtered or unexported fields }
type StepSetDefaults ¶ added in v1.0.9
type StepSetDefaults struct{}
func (*StepSetDefaults) Cleanup ¶ added in v1.0.9
func (s *StepSetDefaults) Cleanup(state multistep.StateBag)
func (*StepSetDefaults) Run ¶ added in v1.0.9
func (s *StepSetDefaults) Run(ctx context.Context, 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(ctx context.Context, state multistep.StateBag) multistep.StepAction
type WindowsContainerCommunicator ¶
type WindowsContainerCommunicator struct {
Communicator
}
func (*WindowsContainerCommunicator) Download ¶
func (c *WindowsContainerCommunicator) 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
Source Files ¶
- artifact_export.go
- artifact_import.go
- builder.go
- comm.go
- communicator.go
- config.go
- config.hcl2spec.go
- dockerfile_config.go
- dockerfile_config.hcl2spec.go
- driver.go
- driver_docker.go
- driver_mock.go
- ecr_login.go
- exec.go
- step_build.go
- step_commit.go
- step_connect_docker.go
- step_default_generated_data.go
- step_export.go
- step_pull.go
- step_run.go
- step_set_defaults.go
- step_temp_dir.go
- windows_container_communicator.go