Configuring Docker server with Automation

Mahima jindal
3 min readNov 25, 2020


This article is all about the Integration of Docker with Ansible . In this we are going to configure Docker on the Managed node without going manually to that node.

Controller Node

It is a node that runs on any machine which hosts VMs and interact with both OS and hypervisor to maintain the lifecycle of instances running on each of the host nodes.

Note : Ansible is only installed on the Controller Node.

Managed Node

The Remote nodes or the hosts which are managed or controlled by the controller node are known as Managed Nodes.


Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers. It also has the capability to launch o.s in just one sec ,containers are isolated from one another and bundle their own software, libraries and configuration files.

Lets start building this setup…

Firstly we have to check whether the Ansible is installed on the Controller Node

After this we have to make a directory where we have to put the Ip ,Username and Password of the Managed node we want to configure .

This Managed node is also known as Inventory.

We have to set this inventory in the default cofiguration file of Ansible. The default location for inventory file is /etc/ansible/hosts.Also we can make a project specific inventory files in alternative locations .

My inventory file is /etc/ansible/ansible.cfg

Further we have to create this Playbook where we have to create the code that we want to cofigure in Managed node.

This Playbook will automatically configure the Docker repo in the Managed node and after that it will also launch one container and configure it as a server.

Now run this Playbook….

Now as the managed node is configured successfully , we have to manually go to the managed node and check whether everything is configured or not.

you can see here docker is configured in managed node properly and webpage(index.html) is also there,we just have to run one command to make this file executable.

#chmod 777 index.html

Lastly we can check the on the browser ,container is successfully exposed and the web looks like this…

This is all what i did in this article.

Hope it was helpful and if any upgradation needed then please suggest me.

Thank you