Puppet+Docker:Creating a Docker service using a Puppet manifest

0 votes
I want to create a distributed application across multiple swarm nodes for which i need to create a docker service. How can i achieve this objective using puppet?
Aug 14 in Puppet by Priya
21 views

1 answer to this question.

0 votes
  • Docker services are used to create distributed applications across multiple swarm nodes. 

  • Each Docker service replicates a set of containers across the swarm.

  • To create a Docker service, add the following code to the manifest file:

docker::services {'redis':
    create => true,
    service_name => 'redis',
    image => 'redis:latest',
    publish => '6379:639',
    replicas => '5',
    mounts => ['type=bind,source=/etc/my-redis.conf,target=/etc/redis/redis.conf,readonly'],
    extra_params => ['--update-delay 1m', '--restart-window 30s'],
    command => ['redis-server', '--appendonly', 'yes'],
  }
  • To base the service off an image, include the image parameter and include the publish parameter to expose the service port (use an array to specify multiple published ports). 

  • To set the amount of containers running in the service, include the replicas parameter. 

  • To attach one or multiple filesystems to the service, use the mounts parameter. 

  • For information regarding the extra_params parameter, see docker service create --help

  • The command parameter can either be specified as an array or a string.

answered Aug 14 by Sirajul
• 25,220 points
Puppet+Docker: How to Update/Remove a docker service?

Related Questions In Puppet

0 votes
1 answer

Puppet+Docker: Restarting docker service via puppet manifest

Try adding this: service { 'docker': ensure ...READ MORE

answered Aug 13 in Puppet by Sirajul
• 25,220 points
12 views
0 votes
1 answer

Puppet+Docker: How to Update/Remove a docker service?

Update a docker service: To update the service, add ...READ MORE

answered Aug 14 in Puppet by Sirajul
• 25,220 points
26 views
0 votes
1 answer

Puppet+Docker: How do i configure a swarm if i am using windows server 2016.

There are a few considerations to be ...READ MORE

answered Aug 16 in Puppet by Sirajul
• 25,220 points
17 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,520 points
152 views
0 votes
0 answers
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
• 25,220 points
29 views