Puppet and Docker docker exec doesn t start puppet container automatically

0 votes

 I need to run the command docker exec to start the container and run the following commands to get it started and create the ca certificates in its ssl directory:

puppet master --verbose 
service puppetmaster start
chkconfig puppetmaster on

Here's the dockerfile for a puppet container for a certificate authority.This doesn't start automatically,

FROM centos:6
RUN yum update -y
RUN rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
RUN yum install -y ruby puppet-server  
ADD puppet.conf /etc/puppet/puppet.conf

VOLUME ["/var/lib/puppet/ssl/"]
EXPOSE 9140

#NOTHING BELOW THIS COMMENT RUNS
RUN puppet master --verbose 

CMD service puppetmaster start
CMD chkconfig puppetmaster on
CMD []

The container can be started using the run(note that I named the image ca-puppet):

docker run -d -p 9140:9140 -it --name ca-puppet \
-v /puppet-host/ssl:/var/lib/puppet/ssl \
ca-puppet bash

Aug 30, 2019 in Puppet by Sheeba
985 views

1 answer to this question.

0 votes

There can only be one CMD instruction in a Dockerfile. If you list more than one CMD then only the last CMD will take effect.

If the user specifies arguments to docker run then they will override the default specified in CMD.

Try not daemonizing puppet and start it as the default container command via something like:

CMD puppet master --verbose --no-daemonize

And use the Docker host to manage it (via restart policy, etc.).

answered Aug 30, 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
1,321 views
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
520 views
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
717 views
0 votes
1 answer

Puppet+Docker: How can a user initialize, join and leave the swarm?

The docker module has an example task ...READ MORE

answered Aug 14, 2019 in Puppet by Lilly
810 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,090 points
2,435 views
0 votes
0 answers

Puppet+Docker: pull an image and launch a container

I am experimenting on integrating a containerization ...READ MORE

Aug 13, 2019 in Puppet by Sam
• 6,260 points
1,786 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