Configuring HTTPD Server on Docker Container and Setting up Python Interpreter

Neha sonone
4 min readNov 3, 2020

--

**I will also soon be publishing it on GeeksforGeeks

https://www.geeksforgeeks.org/

How to configure the HTTPD server on Docker container?

  • first we need to install docker in your VM so for that go to
cd  /etc/yum.repos.d/
  • create a repo by giving any name by the command vim d.repo and give this URL
  • after this u can install docker by the command
yum install docker-ce  --nobest
  • to check docker installed or not run the command.
rpm  -q  docker-ce
  • to start the service and to check the status of docker u can run the following commands
systemctl start dockersystemctl status docker

Now to configure the web server on the top of docker container these are the steps:

  • launch a docker container with an image
  • inside which we install webserver program(Apache server)
  • starting the server
  • inside the docker we install python interpreter(python3)

before launching the container in docker make sure to stop firewalld and then restart docker.

  • Now to launch one os /container on the top of docker we need an image u can use image as per u want I'm here using ubuntu :20.10 image for downloading image u can get it from https://hub.docker.com/ to download the image we have to use just one command
docker pull ubuntu:20.10

now u can launch container by this image #docker run -i -t -name taskd ubuntu:20.10 ,exit is the command to come out of the container ,u can check how many os is stopped and running also by the command #docker ps -a

  • to go inside the exited docker container we have one command #docker attach taskd
  • Now we can start the installation in docker container first we use the command #apt-get update ,apt-get update command is used to download package information from all configured sources. … So when you run update command, it downloads the package information from the Internet. It is useful to get info on an updated version of packages or their dependencies.
  • Now we can install apache web server on the top of docker container by the command #apt-get install apache2 , in ubuntu we have this command apt-get to download and install any software
  • Now we have to install systemctl by the command #apt-get install systemctl
  • #apt-get install net-tools this will help u to run ifconfig command
  • #apt-get install vim
  • Now after this installation part gets done we have to configure web server we need to go to cd /var/www/html/ and there we have to create a simple website vim hello.html
  • Now start the service by command #systemctl start appache2 .and check the status make sure its active.
  • Now get the IP by ifconfig command and put inside firefox to see output IP/hello.html

Setting up the Python Interpreter in docker container

  • first we need to install python3 by the command
  • To see python3 is installed or not

Thank you for reading :)

--

--

Neha sonone
Neha sonone

Responses (1)