Puppet in Docker Can a docker container use Puppet only at Run-time

0 votes
I want my container to have access to Puppet only when it's running. But I don't want to have Puppet software installed into all my containers. Is there a way that my container can access puppet only whenever it runs despite of the fact that it doesn't have puppet installed on it explicitly? Is this feature supported in puppet or docker?
Aug 19, 2019 in Puppet by Karan
• 19,610 points

1 answer to this question.

0 votes

Docker provides a solution to this problem with Volumes.

  • Volumes allow for directories from one container to be mounted into another at runtime.

  • In the context of Puppet that means we can make the Puppet software available to any container we like by mounting the /opt/puppetlabs directory (which contains Puppet and all it's dependencies due to the all-in-one packaging).


  • First run a puppet-agent container. 

  • This will terminate once the command has run, just outputting the Puppet version, but the volume will persist.

docker run --name puppet-agent -v /opt/puppetlabs puppet/puppet-agent-ubuntu --version
  • With that volume in place we can use it in any other containers via the handy --volumes-from command.

docker run --volumes-from=puppet-agent ubuntu /opt/puppetlabs/bin/puppet resource package tar --param provider
package { 'tar':
  ensure   => '1.27.1-1',
  provider => 'apt',
  • Note the name of the original container (which contains Puppet) is used in the volumes-from argument for this container. 

  • To prove we're really adding Puppet at runtime, if we run without mounting the volume:

docker run ubuntu /opt/puppetlabs/bin/puppet resource package
docker: Error response from daemon: Container command '/opt/puppetlabs/bin/puppet' not found or does not exist..
  • You could cross check it using the method mentioned above.

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

Related Questions In Puppet

0 votes
1 answer

Is it possible to install puppet agent in a docker container on linux?

Hey @Janice, this is pretty simple. Create ...READ MORE

answered Mar 12, 2019 in Puppet by Jason
0 votes
1 answer

Puppet+Docker: How do i configure my docker container to use a NFS volume through a Hiera config file?

If using Hiera, configure the docker::volumes class in the ...READ MORE

answered Aug 14, 2019 in Puppet by Sirajul
• 59,230 points
0 votes
1 answer
0 votes
1 answer
+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,090 points
0 votes
1 answer

Puppet+Docker: How do i configure my docker container to use a NFS volume?

docker_volume { 'nfs-volume': ensure => ...READ MORE

answered Aug 13, 2019 in Puppet by Sirajul
• 59,230 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP