Use Ansible and Packer to create a Docker image

Bruno Delb
Open DevOps Academy
4 min readMar 14, 2021

--

To create a Docker image, you usually use Docker CLI with the docker build command. One of the advantages is that this command creates one layer per line of the Dockerfile.
However, when you create several Docker images with common code, it may be appropriate to use the Ansible role concept.

Packer helps us to integrate Ansible into the process of building a Docker image. It is then possible to share common parts of Docker images via Ansible roles. But the disadvantage is that you no longer benefit from Docker’s layer-based…

--

--

Blockchains, DevOps, Agile Coaching, development, testing, Cloud, Management 3.0, ITIL. It defines me.