Configuring HTTPD Server and Python Interpreter on Docker Container and running Python code in the container.

ADAMAYA SHARMA
2 min readNov 23, 2020

--

To configure httpd server on the docker container do the following steps

firstly launch a docker container in interactive mode using the following command

docker container run -t --name httpd_c centos

now install the httpd server in the docker container using yum.

yum install httpd -y
launching a centos container and installing httpd server on that container

In the centos docker container to start the HTTPD server user need to run the httpd program. httpd program is situated at /usr/sbin/ folder in centos container.

/usr/sbin/httpd
starting httpd server

172.17.0.2 is the assigned internal IP of the container. so to check httpd server is running or not, enter the IP of the container on your base OS browser.

OUTPUT: Configured httpd Server

Now httpd container is configured.

To configure the python container launch another centos container.

docker container run -it --name python_c centos

now install the python interpreter using yum in the docker container.

yum install python3 -y

to run the python the interpreter simply runs “python3” on the container terminal. python interpreter and its terminal will be launched.

simply write the code and run them.

Hope you find this useful.

--

--