Launching Webserver on the Top of Docker Using Ansible Play-book | Arth | Task-10 |
--
Task-Description
š¹ Configure Docker
š¹ Start and enable Docker services
š¹ Pull the httpd server image from the Docker Hub
š¹ Run the docker container and expose it to the public
š¹ Copy the html code in /var/www/html directory and start the web server
Task-Steps
Step-1: Installing docker in linux is not very simple job. First we have to create a repo file for docker with given baseurl
https://download.docker.com/linux/centos/7/x86_64/stable/
Step-2: There are some broken file in this base URL, so we canāt use package module to install docker. We can use command/shell module with ā nobestā option.
Step-3: Now i am going to start the docker service.
Step-4: It is important to install docker SDK before doing any docker operation from ansible.
Step-5: In this step I am going to pull http docker image.
Step-6: Create a directory and copy our code in this directory later we mount this to docker containerās document root.
Step-7: Now launching a docker container.
Here I gave 8080 port to expose the container & also mounted the volume.
Step-8: Now to expose the container for outside world we have to allow 8080 port in the firewall.
Now lets run the play-book
Letās from the Target node that all tasks are completed or not.
Repository & Software check-
Docker service Status check-
Docker SDK check-
Docker image & Docker Container check-
Inspect Docker container-
Checking the active ports-
Now let check our webserver is working or not.
Yeppie itās working
Our task is completed.
For code ā
!!!Thanks For Reading the Article!!!