Puppet in Docker: How can I use docker to create a container that has puppet inside and can perform any instruction just like how a Puppet Manifest does?

0 votes
Aug 19 in Puppet by Liana
20 views

1 answer to this question.

0 votes

Run the following docker command:

$ docker run --name apply-test puppet/puppet-agent apply -e 'file { "/tmp/adhoc": content => "Written by Puppet" }'

This will pull the puppet/puppet-agent image from Docker Hub and use Puppet to apply a change, namely creating a file in /tmp/adhoc containing the words, “Written by Puppet.”

If you now run a diff on that container, you’ll see what’s changed from the original image. 

In this case, upon running, the container created new folders and added content to them, including the /tmp/adhoc file:

root@node02:~# docker diff apply-test
C /etc
C /etc/puppetlabs
C /etc/puppetlabs/puppet
A /etc/puppetlabs/puppet/ssl
A /etc/puppetlabs/puppet/ssl/certificate_requests
A /etc/puppetlabs/puppet/ssl/certs
A /etc/puppetlabs/puppet/ssl/private
A /etc/puppetlabs/puppet/ssl/private_keys
A /etc/puppetlabs/puppet/ssl/public_keys
...
C /tmp
A /tmp/adhoc

This approach is much faster when compared to the conventional way of creating a separate puppet node.

answered Aug 19 by Sirajul
• 25,700 points

Related Questions In Puppet

0 votes
1 answer

Does puppet forge have modules that i can use to Install LAMP stack?

Puppet forge has modules for installing and ...READ MORE

answered Jul 30 in Puppet by Sirajul
• 25,700 points
20 views
0 votes
1 answer
0 votes
1 answer

Puppet in Docker : How to mount Puppet on a CentOS container?

Run the following command: docker run --volumes-from=puppet-agent centos ...READ MORE

answered Aug 19 in Puppet by Sirajul
• 25,700 points
9 views
0 votes
1 answer

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

Docker provides a solution to this problem ...READ MORE

answered Aug 19 in Puppet by Sirajul
• 25,700 points
19 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,540 points
156 views
0 votes
1 answer
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 in Puppet by Sirajul
• 25,700 points
20 views