From d1961e782b364082706d11d4a70f4e4ec6937ad9 Mon Sep 17 00:00:00 2001 From: Danny Guinther Date: Tue, 30 Jun 2015 08:16:31 -0400 Subject: [PATCH] Be more explicit about sequence definition usage in docker builder docs --- .../source/docs/builders/docker.html.markdown | 53 +++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/website/source/docs/builders/docker.html.markdown b/website/source/docs/builders/docker.html.markdown index c760742ee..b5fe95075 100644 --- a/website/source/docs/builders/docker.html.markdown +++ b/website/source/docs/builders/docker.html.markdown @@ -117,7 +117,10 @@ _exported_. More specifically, if you set `export_path` in your configuration. If you set `commit`, see the next section. 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 { @@ -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 import the image using the process below: @@ -146,9 +155,12 @@ and `docker push`, respectively. ## Using the Artifact: Committed -If you committed your container to an image, you probably want to tag, -save, push, etc. Packer can do this automatically for you. An example is -shown below which tags and pushes the image: +If you committed your container to an image, you probably want to tag, save, +push, etc. Packer can do this automatically for you. An example is shown below +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 { @@ -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 This builder allows you to build Docker images _without_ Dockerfiles.