Sitemap

Configuring HTTPD Server on Docker Container

3 min readApr 1, 2021

Hello Connection…

Today I am here to tell you about how to configure an HTTPD server on a Docker container.

firstly we have to configure docker on the system .

  1. Go to /etc/yum.repos.d/ path and create a repo file for docker.
  2. The baseurl is https://download.docker.com/linux/centos/7/x86_64/stable/
Press enter or click to view image in full size

3. And run the “yum repolist” command to check link work properly or not.

Press enter or click to view image in full size

4. To install the docker command “yum install docker-ce — nobest” .

5. Start the service command “systemctl start docker”.

Download Any image on the docker container with the help of this link:-

Run the docker image on system command is

docker run -it — name webb centos:latest

In Docker container, if yum command not found an error or curl error (6) comes then go to redhat path “vim /etc/firewalld/firewalld.conf”

Press enter or click to view image in full size

Hope your error will be resolve by this process.

Here ifconfig command will also not run we have to install “net-tools” then we have to run the ifconfig command on the docker.

Come to the task……

CONFIGURE HTTPD ON DOCKER

  • Install Httpd service on docker container command “yum install httpd” in my case i have already downloaded.
Press enter or click to view image in full size
  • Then go to this path cd /var/www/html and create a html file by vi command.
Press enter or click to view image in full size
  • Then we have started the service but here systemctl command will not work.
Press enter or click to view image in full size

we are using the command “/usr/sbin/httpd” for starting the webserver.

To check service will start or not but here will have only option to check is to see those port number is on or not to check port number command is :- “netstat -tnlp”

Press enter or click to view image in full size
  • Then we have to search on firefox by IP of the machine.
Press enter or click to view image in full size
  • Setting up Python Interpreter and running Python Code on Docker Container

First, we check python environment is there or not , to check the python we have command “rpm -q python” or “python3"

Press enter or click to view image in full size

Then we have to install python by yum command :- “yum install python3”

Press enter or click to view image in full size

we check python is installed or not by command “rpm -q python3” or “python36”

Press enter or click to view image in full size

then we have to print python script

Press enter or click to view image in full size

Thank you !!!!

--

--

No responses yet