đź”…Configuring HTTPD Server on Docker Container

đź”…Setting up Python Interpreter and running

Python Code on Docker Container


Docker is a platform for developers and sysadmins to develop, deploy, and run applications with containers. This is often described as containerization. Putting applications into containers leads to several advantages like:

  • Docker containers are always portable. This means that you can build containers locally and deploy containers to any docker environment (other computers, servers, cloud, etc …)
  • Containers are lightweight because containers are sharing the host kernel (the host operating system) but can also handle the most complex applications.

Containers vs. Virtual Machines

When talking about containerization it is very often compared to virtual machines. Let’s take a look at the following image to see the main difference:

The Docker container platform is always running on top of the host operating system. Containers are containing the binaries, libraries, and the application itself. Containers do not contain a guest operating system which ensures that containers are lightweight.

In contrast, virtual machines are running on a hypervisor (responsible for running virtual machines) and include its own guest operating system. This increased the size of the virtual machines significantly, makes setting up virtual machines more complex, and requires more resources to run each virtual machine.


First of all, you need to make sure that Docker is installed on your system. For the following tutorial, we’ll assume that the Docker Community Edition (CE) is installed.

Docker CE is available for all major platforms including macOS, Windows, and Linux. The specific steps needed to install Docker CE on your system can be found at https://docs.docker.com/install/.

Furthermore, you should make sure to create a free account at https://hub.docker.com, so that you can use this account to sign in to the Docker Desktop application.

Once Docker is installed and running on your system we’re able to start by entering the following command on the terminal:

$ docker version

$ docker info

The output gives you detailed information about the installed version and more information about Docker Container Engine running on your machine.

Step 1: Pull the Docker Image from the Docker Hub

For the list of already existing Docker images go to hub.docker.com

For this, we will be using Docker Image of Ubuntu Linux, Version 14.04. You can also use Centos Docker Image.

To list the Docker Images present in your local machine, you can run this command:

$ docker images

Pull the Ubuntu Linux, Version 14.04 Docker Image from the Docker Hub

$ docker pull ubuntu:14.04

STEP:2:Start the service

cmd: systemctl start docker

To make it permanent in host os i.e.,every time you start the host os use the command,

cmd: systemctl enable docker

To check: docker info [if this cmd run without any error then docker installed successfully]

Launch container on top of Docker

Step 1: docker images

Shows the list of docker images, if you have none in the list, you need to pull the image of required OS.

Step 2: docker pull centos:7

In order to pull centos:7 image.

Step 3: docker run -it centos:7

The above command launches the image on top of docker, now you are inside your container.

Configuring Apache server on top of Container

Step 1: Run command yum install httpd , for installing httpd server.

Step 2: Now you need to start httpd services.

In normal linux OS , systemctl start httpd works for it, but in container OS this command is not supported as you can see in the image below. Rather, you need to use, /usr/sbin/httpd.

You can make html pages in directory /var/www/html. In my case, I made a file task7–2.html with a few lines of code.

After saving the html pages, you need to restart httpd services, using command:

/usr/sbin/httpd -k restart

You can check the successful start of your services, but using the command given below in your base OS.


Setting up Python Interpreter on top of Container

Step 1: yum install python3

Confirm your installation , using command python3.

You can run Python codes and the interpreter successfully displays the output.

Thankyou for Reading!!
For more such articles, Do Follow me..‼

computer engineering