Yes, can be done
TL;DR check this:
for many many dockers, I would suggest have one json per docker and have
something like a make file
but for 2 its still doable
say you have 2 dockers, and you want 3 provision to run, one shared and one
the feature you need is inside each build you can use a name.
for your request, imagine you have db and www but to keep things simple i
just used vim/git
for this example i did
both get htop installed but then a local script run vim gets vim, git gets
root@ubuntu-1604-vmware:/vagrant/multidocker# docker run --rm xenial-vim
which htop vim git
root@ubuntu-1604-vmware:/vagrant/multidocker# docker run --rm xenial-git
which htop vim git
so when you build you can run provisioners like shell, if you filter with
`only` you can have an specific one
as you have names on each builder then you can filter on post-processor to
have a tag on the one you want to tag,
git -> git
vim -> vim
Let me know if there is any question, I think the json in the repo is
clear, but feel free to reach out if not.
On Wed, Mar 7, 2018 at 11:16 AM, Loric Brevet <loric.bre...@gmail.com>
> I am planning to move one of my projects from plain Dockerfiles to Packer
> I currently have two images built with Dockerfiles composing one
> docker-compose.yml project as followed.
> version: '3'
> build: Dockerfile.web
> - "5000:5000"
> build: Dockerfile.db
> My question was: should I use one package.json per Dockerfile or should I
> build both images from the same package.json?
> I have seen we can use several builders and post-processors with Packer
> but of what I understand, this feature mostly targets the use case of
> building the same image for various platforms (e.g. Docker + Vagrant) at
> the same time.
> For my case here, I would like to build two different images not related
> to each others and using different provisioning roles in a same playbook.
> Usually, a unique Ansible playbook script is used to provision several
> images according to its inventory (here I would have the web container and
> db container in the inventory), but I am not sure I can do this with Packer.
> Thanks in advance,
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to packer-tool+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> For more options, visit https://groups.google.com/d/optout.
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
To view this discussion on the web visit
For more options, visit https://groups.google.com/d/optout.