I have read https://www.packer.io/docs/builders/docker.html, but I do not see the advantage of using Packer over docker build or docker-compose up --build for building docker images

  • Just because moving from docker image to AWS ami or any other provider type of image is just a matter of changing the provider ?
    – Tensibai
    Commented Sep 8, 2017 at 12:09
  • 1
    I'm tempted to close this one as duplicate of your other question as the answer I provided there does answer this question also.
    – Tensibai
    Commented Sep 8, 2017 at 12:12
  • Agreed. Perhaps you could transform the comment to an answer for clarity.
    – 030
    Commented Sep 8, 2017 at 12:26
  • 1
    Edited the answer on the other post so the information is not scattered on two posts.
    – Tensibai
    Commented Sep 8, 2017 at 12:32
  • 1
    Well, the omission of dockerfiles is exactly what I state by changing provider, your describe the content of your image whatever the image is. But I've reopen to let others bring more details if needed. I'll add as an answer my comment above also.
    – Tensibai
    Commented Sep 8, 2017 at 12:51

1 Answer 1


Mainly the reason is to keep your image building steps intact if you get to move from docker to another image building system.

Packer does support a bunch of providers (builders in packer terminology), and changing the target "container" is just a matter of changing the builder (or using multiple builders in the same packer file), the build steps (provisionner step) are kept intact and will be the same if you build a docker image or an AWS ami for example (you can even build both at the same time).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.