Puppet Build multiple images using a puppet manifest

0 votes

I have to build multiple docker images, should i have multiple dockerfiles for all those images that i want to build using puppet? 

I am using Puppetlabs/image_build module from the puppet forge in order to build docker images. How do I build multiple images using a puppet manifest?

Aug 20, 2019 in Puppet by Kim
817 views

1 answer to this question.

0 votes

One advantage of using Puppet for building Docker images is you are removed from the need to have a single Dockerfile per image. 

Meaning a single repository of Puppet code can be used to describe multiple images

This makes ensuring all images use (for example) the same repositories or same hardening scripts much easier to enforce. Change code in one place and rebuild multiple images.

Describing multiple images in Puppet is done using the existing node resource in your manifest. For instance:

node 'node1' {
  webserver { 'hello node 1': }
}
node 'node2' {
  webserver { 'hello node 2': }
}

You can then select which image to build when running the build command, by explicitly passing the image-name.

puppet docker build --image-name puppet/node1

The match for the node resource in the Puppet code is done without the repository name, in this case the puppet/before node1.

Note that you may want different metadata for different images. 

image_build will attempt to detect additional metadata in the metadata folder, and will merge items from metadata/metadata.yaml with node specific metadata, for instance from metadata/node1.yaml

answered Aug 20, 2019 by Sirajul
• 59,230 points

Related Questions In Puppet

0 votes
1 answer

Managing a NTP service using Puppet

You’ve just  finished installing the puppetlabs-ntp module. The next step ...READ MORE

answered Jul 25, 2019 in Puppet by Sirajul
• 59,230 points
2,371 views
0 votes
1 answer

What are the advantages of using Puppet as a CM tool?

Here's a list of a few advantages ...READ MORE

answered Jul 30, 2019 in Puppet by Sirajul
• 59,230 points
1,491 views
0 votes
1 answer

Puppet: Deploy configuration changes using a orchestrator

You can use the orchestrator to enforce ...READ MORE

answered Aug 1, 2019 in Puppet by Sirajul
• 59,230 points
692 views
0 votes
1 answer

How can i execute a single class from my puppet manifest file?

You can execute a subset of resources ...READ MORE

answered Aug 6, 2019 in Puppet by Sirajul
• 59,230 points
2,383 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,714 views
0 votes
0 answers
0 votes
1 answer

Puppet+Docker:Creating a Docker service using a Puppet manifest

Docker services are used to create distributed ...READ MORE

answered Aug 14, 2019 in Puppet by Sirajul
• 59,230 points
919 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP