Puppet in Docker : How do i create puppet containers?

0 votes

I want to create a puppet master server and a puppet client using docker containers. ie. I basically want to create two puppet containers. How do i go about doing this without having to use a docker-compose.yml file?

Aug 20 in Puppet by jane
57 views

1 answer to this question.

0 votes

For creating puppet containers, first we need to download the Puppet packages from the docker hub.

  • puppet/puppet-agent-ubuntu

  • puppet/puppetserver

  • puppet/puppetdb

  • puppet/puppetdb-postgres

You can use the command docker pull Image_name for that.

root@ubuntu:~# docker pull puppet/puppetserver

root@ubuntu:~# docker pull puppet/puppetdb

root@ubuntu:~# docker pull puppet/puppetdb-postgres

root@ubuntu:~# docker pull puppet/puppet-agent-ubuntu

Now that we have downloaded all required images, you can view it by running docker images command.

root@ubuntu:~# docker images

Before creating our Puppet container, we need to create a Docker network to add these Puppet containers as below.

root@ubuntu:~# docker network create puppet

Creating Puppet Master server:

We can create puppet server with the image "puppet/puppetserver" with name puppet in the puppet network with hostname "puppet-sample".

root@ubuntu:~# docker run --net puppet --name puppet --hostname puppet.sample puppet/puppetserver

Now we've our Puppet Server created and running, you can verify it as shown below:

root@ubuntu:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f4b9f456a4c2 puppet/puppetserver "dumb-init /docker-en" 3 minutes ago Up 3 minutes 8140/tcp puppet

Creating Puppet Client:

By running this command, you're creating another container as Puppet client with hostname Puppet-client-sample with the docker image puppet/puppet-agent-ubuntu agent.

 You can either use this command to create the Puppet client or you can just use docker run --net puppet puppet/puppet-agent-ubuntu  to built one. If you're running this command,  with a onetime flag which means, Puppet exits after the first run.

root@ubuntu:~# docker run --net puppet --name puppet-client --hostname puppet-client-sample puppet/puppet-agent-ubuntu agent --verbose --no-daemonize --summarize

But if you're using this above command, then the container won't exit, It stays online and updates Puppet every 30 minutes based on the latest content from the Puppet Server. Now we've our Puppet server/Client running on our Docker.

root@ubuntu:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5f29866a103b puppet/puppet-agent-ubuntu "/opt/puppetlabs/bin/" 8 minutes ago Up 8 minutes puppet-client
f4b9f456a4c2 puppet/puppetserver "dumb-init /docker-en" 13 minutes ago Up 13 minutes 8140/tcp puppet

answered Aug 20 by Sirajul
• 37,480 points
Puppet in Docker: Creating a PuppetDB container.

Related Questions In Puppet

0 votes
1 answer

Puppet in Docker : How do i run my dockerized puppet container periodically?

Instead of running a Dockerized puppet container onetime, ...READ MORE

answered Aug 19 in Puppet by Sirajul
• 37,480 points
40 views
0 votes
1 answer

Puppet in Docker: How do I query PuppetDB API in a container setup?

PuppetDB exposes a dashboard, showing various operational ...READ MORE

answered Aug 20 in Puppet by Sirajul
• 37,480 points
36 views
0 votes
1 answer

How do I enable puppet collection repository in puppet if I am using Puppet 6.7?

In Puppet6.7 you have to enable Puppet ...READ MORE

answered Jul 31 in Puppet by Sirajul
• 37,480 points
36 views
0 votes
0 answers

How do i set up docker with puppet?

I want to use puppetlabs/docker module in ...READ MORE

Aug 13 in Puppet by Karan
• 5,500 points
33 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,920 points
223 views
0 votes
1 answer