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 in Puppet by Kim
23 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 by Sirajul
• 36,620 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 in Puppet by Sirajul
• 36,620 points
84 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 in Puppet by Sirajul
• 36,620 points
25 views
0 votes
1 answer

Puppet: Deploy configuration changes using a orchestrator

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

answered Aug 1 in Puppet by Sirajul
• 36,620 points
43 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 in Puppet by Sirajul
• 36,620 points
31 views
0 votes
1 answer
0 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
• 56,900 points
218 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 in Puppet by Sirajul
• 36,620 points
33 views