packer-cn/website/pages/docs/post-processors/docker-push.mdx

70 lines
2.7 KiB
Plaintext
Raw Normal View History

2020-03-18 18:46:47 -04:00
---
description: |
The Packer Docker push post-processor takes an artifact from the docker-import
post-processor and pushes it to a Docker registry.
layout: docs
page_title: Docker Push - Post-Processors
sidebar_title: Docker Push
2020-03-18 18:46:47 -04:00
---
# Docker Push Post-Processor
Type: `docker-push`
The Packer Docker push post-processor takes an artifact from the
2020-03-31 17:40:07 -04:00
[docker-import](/docs/post-processors/docker-import) post-processor and
2020-03-18 18:46:47 -04:00
pushes it to a Docker registry.
## Configuration
This post-processor has only optional configuration:
- `aws_access_key` (string) - The AWS access key used to communicate with
AWS. [Learn how to set
2020-03-31 17:40:07 -04:00
this.](/docs/builders/amazon#specifying-amazon-credentials)
2020-03-18 18:46:47 -04:00
- `aws_secret_key` (string) - The AWS secret key used to communicate with
AWS. [Learn how to set
2020-03-31 17:40:07 -04:00
this.](/docs/builders/amazon#specifying-amazon-credentials)
2020-03-18 18:46:47 -04:00
- `aws_token` (string) - 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.
- `aws_profile` (string) - The AWS shared credentials profile used to
communicate with AWS. [Learn how to set
2020-03-31 17:40:07 -04:00
this.](/docs/builders/amazon#specifying-amazon-credentials)
2020-03-18 18:46:47 -04:00
- `ecr_login` (boolean) - Defaults to false. If true, the post-processor will
login in order to push the image to [Amazon EC2 Container Registry
(ECR)](https://aws.amazon.com/ecr/). The post-processor only logs in for
the duration of the push. If true `login_server` is required and `login`,
`login_username`, and `login_password` will be ignored.
- `keep_input_artifact` (boolean) - if true, do not delete the docker image
after pushing it to the cloud. Defaults to true, but can be set to false if
you do not need to save your local copy of the docker container.
- `login` (boolean) - Defaults to false. If true, the post-processor will
login prior to pushing. For log into ECR see `ecr_login`.
- `login_username` (string) - The username to use to authenticate to login.
- `login_password` (string) - The password to use to authenticate to login.
- `login_server` (string) - The server address to login to.
2020-03-23 20:02:12 -04:00
-> **Note:** When using _Docker Hub_ or _Quay_ registry servers, `login`
2020-03-18 18:46:47 -04:00
must to be set to `true` and `login_username`, **and** `login_password` must to
be set to your registry credentials. When using Docker Hub, `login_server` can
be omitted.
2020-03-23 20:02:12 -04:00
-> **Note:** If you login using the credentials above, the post-processor
2020-03-18 18:46:47 -04:00
will automatically log you out afterwards (just the server specified).
## Example
For an example of using docker-push, see the section on using generated
2020-03-31 17:40:07 -04:00
artifacts from the [docker builder](/docs/builders/docker).