top of page
Search
Writer's pictureroshnipatil1314

Docker..

>>>Task Description📄

Docker Task---🔰Configuring HTTPD Server on Docker Container


>>>Some Basic Concepts📄

  • What is Docker ..??

Docker is a container management service. The keywords of Docker are develop, ship and run anywhere. The whole idea of Docker is for developers to easily develop applications, ship them into containers which can then be deployed anywhere .With docker , you can manage your infrastructure in the same ways you manage your applications.



  • Apache HTTPD ....??

Apache HTTPD is an HTTP server daemon produced by the Apache Foundation .HTTP Daemon is a software program that runs in the background of a web server and waits for the incoming server requests. The daemon answers the request automatically and serves the hypertext and multimedia documents over the Internet using HTTP.


>>>Prerequisites


*Configure the yum


>>>Steps to implement the given task

  • install the docker

  • Pull the OS image and then install container(OS)

  • Configured Webserver

 

Step1 :- For installing the docker we have to make sure that your yum must be configured properly after that you have to run the given command

command to install docker :-
yum install docker-ce --nobest

after running this command , docker will install successfully .

Now we are going to run one command through which we check that the docker is successfully installed or not..

 rpm -q docker-ce


Here we can see that the docker is installed successfully .Now we have to start the service of docker.


command to start the service :-
systemctl start docker 

command to check the status :-
systemctl status docker

Here we can see that the docker status is active ,hence our docker service is started successfully. So here our first part is complete , now move to the next part


 

Step2 :- As we have ISO file for installing any Operating System. Similarly in docker, we have docker images for installing any container ( Container == OS) . Command to download the any image ..

docker pull image_name:tag

In my case image_name is "centos" ...

Now we are going to install one container( Operating System) on the top of the docker.. Command to install the docker is given below ..


 docker run -it -p 81:80 --name webserver centos:latest

Description of the above command :-

  • -it :- It gives the interactive terminal to our container (OS) , so we can run any command..

  • -p :- We have to expose our container to the outside world , so with the help of this option we are going to bind our local port to the docker port , (80 is the port number of docker )..

  • --name :- This is used for assigning a name to our container..

Now we are going to check.. that the container is installed successfully or not .So for this we have to run the command which is given below but you have to run this command on your base OS

command :-
docker ps 

Here our container is installed successfully and we are now on the top of new os ..So here our 2nd part is complete now move to the third part..

 

Step3 :- For configuring any server , we have to follow three steps ..

  • installed that server..

  • configure that server ..

  • start the service of that server ..

but before installing the web server we have to first run some commands on the base OS..

Commands:-

# Masquerading allows for docker ingress and egress 
    ▪️firewall-cmd --zone=public --add-masquerade --permanent

# Specifically allow incoming traffic on port 80/443 (nothing new here)
    ▪️firewall-cmd --zone=public --add-port=80/tcp
    ▪️firewall-cmd --zone=public --add-port=443/tcp

# Reload firewall to apply permanent rules
    ▪️firewall-cmd --reload

#Restart docker 
    ▪️systemctl restart docker

Why we have to run the above commands .....🤔🤔??

---> If we want to download anything from the internet on the top of the docker container then we have to get the permission from the red hat firewall ...

After that we can download the httpd server with the command given below ......

yum install httpd -y

So here our apache web server is downloaded successfully ,now we have to confiigure it . so for configuring we have to go to the /var/www/html directory and then create one file of html code ..

Change the directory
Html code

Now we have to start the service ..here "systemctl start docker " is not working ,because docker doesn't support systemctl , so for starting the service we have to run this command ..

command:-
/usr/bin/httpd

Now we have to check that our service is started or not . So for that we have to run one command , but we have to first download the software which provide this command . so for find out the software name run one cmd "yum whatprovides netstat" .This command will gives us the software name . So now we have to download that software with help of yum command .

Here we can see the software is downloaded successfully now we have to run this command to check the service is started or not ..

Command :-
netstat -tlnp

Here we can see that the service is started successfully ... Now we have to do the last step that is run that html file through browser . For this just put IP of your base OS , port number and file name in your browser

Format :- IP:Port_number /file_name ( in my case port_number is 81)


So here we are successfully configuring the HTTPD Server on Docker Container🤗🤗 ..


Here our task is completed successfully.....


 


Thank you for visiting my article 😊😊
50 views0 comments

Recent Posts

See All

コメント


Post: Blog2_Post
bottom of page