Be more explicit about sequence definition usage in docker builder docs

This commit is contained in:
Danny Guinther 2015-06-30 08:16:31 -04:00
parent 18e29e0f2b
commit d1961e782b
1 changed files with 49 additions and 4 deletions

View File

@ -117,7 +117,10 @@ _exported_. More specifically, if you set `export_path` in your configuration.
If you set `commit`, see the next section. If you set `commit`, see the next section.
The example below shows a full configuration that would import and push The example below shows a full configuration that would import and push
the created image: the created image. This is accomplished using a sequence definition (a
collection of post-processors that are treated as as single pipeline, see
[Post-Processors](/docs/templates/post-processors.html)
for more information):
```javascript ```javascript
{ {
@ -134,6 +137,12 @@ the created image:
} }
``` ```
In the above example, the result of each builder is passed through the defined
sequence of post-processors starting first with the `docker-import`
post-processor which will import the artifact as a docker image. The resulting
docker image is then passed on to the `docker-push` post-processor which handles
pushing the image to a container repository.
If you want to do this manually, however, perhaps from a script, you can If you want to do this manually, however, perhaps from a script, you can
import the image using the process below: import the image using the process below:
@ -146,9 +155,12 @@ and `docker push`, respectively.
## Using the Artifact: Committed ## Using the Artifact: Committed
If you committed your container to an image, you probably want to tag, If you committed your container to an image, you probably want to tag, save,
save, push, etc. Packer can do this automatically for you. An example is push, etc. Packer can do this automatically for you. An example is shown below
shown below which tags and pushes the image: which tags and pushes an image. This is accomplished using a sequence
definition (a collection of post-processors that are treated as as single
pipeline, see [Post-Processors](/docs/templates/post-processors.html) for more
information):
```javascript ```javascript
{ {
@ -165,6 +177,39 @@ shown below which tags and pushes the image:
} }
``` ```
In the above example, the result of each builder is passed through the defined
sequence of post-processors starting first with the `docker-tag` post-processor
which tags the committed image with the supplied repository and tag information.
Once tagged, the resulting artifact is then passed on to the `docker-push`
post-processor which handles pushing the image to a container repository.
Going a step further, if you wanted to tag and push an image to multiple
container repositories, this could be accomplished by defining two,
nearly-identical sequence definitions, as demonstrated by the example below:
```javascript
{
"post-processors": [
[
{
"type": "docker-tag",
"repository": "mitchellh/packer",
"tag": "0.7"
},
"docker-push"
],
[
{
"type": "docker-tag",
"repository": "hashicorp/packer",
"tag": "0.7"
},
"docker-push"
]
]
}
```
## Dockerfiles ## Dockerfiles
This builder allows you to build Docker images _without_ Dockerfiles. This builder allows you to build Docker images _without_ Dockerfiles.