Configuring a Webserver on the Top of Docker Using Ansible

Mihir Patel
3 min readJan 1, 2021

Docker

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.

Apache Web Server

Apache HTTP Server is a free and open-source web server that delivers web content through the internet. It is commonly referred to as Apache and after development, it quickly became the most popular HTTP client on the web. It’s widely thought that Apache gets its name from its development history and process of improvement through applied patches and modules but that was corrected back in 2000. It was revealed that the name originated from the respect of the Native American tribe for its resiliency and durability.

Following step we will use to setup ..

  1. Configure Docker.F
  2. Start and enable Docker services.
  3. Pull the httpd(Apache) server image from the Docker Hub.
  4. Run the docker container and expose it to the public.
  5. Copy the html code in /var/www/html directory and start the webserver.

The code of this practical shown below ..

Now we will create the ansible playbook :

Our inventory is Target node is (192.168.0.113) in which top of we create the server by single click :

Now playbook name is myhttpd.yml :

Step 1 :creating yum repo for docker

Step 2 : Installing docker software & start service

Step 3 : Pull docker httpd image

Step 4: Creating directory and put website

our page is

Step 5 : Now finally Creating the docker container

Now see docker container is started or not .

Successfully started ..

Now Type the url and see the website 😎 :

Successfully run …

--

--

Mihir Patel
Mihir Patel

No responses yet