Configuring HTTPD Server on Docker Container

So, We have been given these small tasks to complete under the Docker container topic, and it’s very easy to use without any complications.

Step 1 : Start Docker Services and run the CentOS image

We can run a previously created image using the command docker run -dit — name webos centos:latest

This will execute and create a container. Now, we need to start and attach the container.

Step 2: Disabling the SELinux Security.

It’s the internal security for administrative permissions to execute containers or automation softwares like Jenkins.

Step 3 : Installing httpd package inside the container

Use the command yum install httpd to install the httpd package.

Step 4 : Creating a html file inside the /var/www/html folder

Creating an html file inside this folder will automatically execute the file and will open the html page while browsing.

Step 5: Installing ifconfig command files

We searched for ifconfig files using yum’s sub-commands

We saw that, it is installed with net-tools, so we installed it using yum install httpd

Step 6 : Starting the httpd service

Execute /usr/bin/httpd file to start httpd service..

Step 7 : Using ifconfig to find the IP and connecting to it using the browser

After we use the ifconfig command, we get the IP Address 172.17.0.2, so we browse to it using the browser and we can see, the html file is executed. This states that we successfully executed a html file inside a docker container.

(B) — Setting up Python Interpreter and running Python Code on Docker Container

Setting up a Python Interpreter inside the Docker Container is very easy, we just need to install Python3 files and make a simple print function in a .py file

Step 1 : Installing python3 files

Use the command yum install python3 to install Python Packages..

Step 2 : Creating and executing a .py file

We created a file hello.py, and executed it using python3 hello.py, which gave us the output of successful execution….

Thank you for Reading.. :D

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

S02E22: Climactic finale

Convert String to numeric data type in Java

Lockdown Browser Uark Download Mac

“?.” Operator in Flutter/Dart

How to use Python in Eclipse?

IN-APP MIB STORE NOW OPEN!

Terraform Weekly – Black Lives Matter (#10)

Time and Space Complexity

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Arya Dhorajiya

Arya Dhorajiya

More from Medium

CONNECT WSO2 API MANAGER AND MYSQL SERVER ON DOCKER.

How to install mongodb to Docker

Node.js Rest CRUD API with MySQL Part 2

Swagger Api