Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (2.3k points)

I have a two containers running on different Docker hosts and to enable communication between them i need to configure an overlay network. Is this supported in puppet+docker integration? How do i manage networks in this case? Suggestions would be of great help.

2 Answers

0 votes
by (12.4k points)
edited by

To manage the network, use the below command inside the manifest file:

docker_network { 'my-net':

  ensure   => present,

  driver   => 'overlay',

  subnet   => '192.168.1.0/24',

  gateway  => '192.168.1.1',

  ip_range => '192.168.1.4/32',

}

And to configure the cluster update the class in the manifest with the below command:

extra_parameters => '--cluster-store=<backend>://172.17.8.101:<port> --cluster-advertise=<interface>:2376'

 Want to learn more about DevOps? Check out: DevOps Course

0 votes
by (6.9k points)

Yes there is support for this. 

Now you can docker itself to create and manage docker networks, but i suppose you are looking to see is puppet can do it instead. Well the answer is yes, using the puppet module & puppet DSL you can create and manage the docker network. 

Her's an example :

docker_network { 'my-overlay-connection':

  ensure   => present,

  driver   => 'overlay',

  subnet   => '192.168.1.0/24',

  gateway  => '192.168.1.1',

  ip_range => '192.168.1.4/32',

}

If no driver is mentioned then docker network will configured as a bridge network. another thing to note is that some networks will require the docker daemon to be used them.

for example you will need to configure a cluster store for overlay network which you can do on docker with the below command:

You can do that on the docker class like so:

extra_parameters => '--cluster-store=<backend>://172.17.8.101:<port> --cluster-advertise=<interface>:2376'

Related questions

+1 vote
1 answer
asked Mar 7, 2020 in DevOps and Agile by chandra (29.3k points)
0 votes
1 answer
asked Jan 17, 2020 in DevOps and Agile by Abhishek_31 (12.7k points)
0 votes
1 answer

Browse Categories

...