ARTH-task7.2 (docker)

AnujGupta
2 min readMar 14, 2021

--

🌀 7.2: Docker Task
🔅Configuring HTTPD Server on Docker Container
🔅Setting up Python Interpreter and running
Python Code on Docker Container

////////////////////////////////////////////////////////////////

Let’s start with httpd server .

pull centos:latest and run it docker pull centos:latest .

run that iage to create instance or container docker run -it — name osfordockertask — image=centos:latest .

IF you exited from that container use docker start os_name and docker attach os_name .

Now, inside container > install httpd and start service yum install httpd -y .

Here systemctl wont work so we have to use /usr/sbin/httpd to start service of httpd .

create webpage in /var/www/html vim index.html .

Install net-tools to see ip inside container . yum install net-tools -y

check port no. with netstat -tnlp

now from base os put ip of that container and port no. on which httpd is running http://ip:port/page_name

note : it will only work inside base os

>>done<<

now python

Install python3 yum install python3 -y

create code : vi code.py < print(“hello world”)

run code python3 code.py

--

--

AnujGupta