RUNNING WEBSERVER ON DOCKER

Rishabh Jain
4 min readApr 1, 2021

--

Namaste! amazing people here comes a new blog on launching the Apache Webserver on the top of the Docker container. Its a new and amazing setup in which first of all the whole Operating system will be launched with in the Base OS in just a second. The Docker is so fast and powerful technique in terms of the Virtualization which is again a superb and beautiful technology in today’s world.

If you are very new to the world Of Docker one can take the reference from the blog given below.

So, let us start to build the setup. But first of all Let me introduce some terminologies so one can be familiar with the setup going to be constructed down.

DOCKER

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.

CONTAINER

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. Available for both Linux and Windows-based applications, containerized software will always run the same, regardless of the infrastructure.

APACHE WEBSERVER

Apache Web Server is an open-source web server creation, deployment and management software. Apache Web Server is designed to create web servers that have the ability to host one or more HTTP-based websites. Notable features include the ability to support multiple programming languages, server-side scripting, an authentication mechanism and database support. Apache Web Server can be enhanced by manipulating the code base or adding multiple extensions or add-ons.

So, lets move for creating the setup.

Pre Requisites For The Setup.

  1. RHEL 8
  2. Docker Installed

So, First of all start the Docker service in the OS as shown below.

Now check whether docker service is started or not by the command shown below.

Now once the docker is started we now need to launch a container by the command shown below.

Now one can see that we are now in a container running on the top of the docker.

We will be now setting up the Web Server on the top of docker. For this we need to follow some steps as shown below.

STEP-1 INSTALLING HTTPD SOFTWARE

To install the software use the command as shown below.

STEP-2 CONFIGURING THE WEB SERVER

  1. Go to the directory by cd command as shown below.

2. Make a new file with index.html as shown below.

3. Write the code or content in the File as shown below.

4. Save the File by the :wq as shown below.

STEP-3 START THE WEBSERVER SERVICE BY THE COMMAND SHOWN BELOW.

Now check whether one is able to reach or not by connecting to the IP of docker within your Base OS as shown below.

The Underlined will be the IP of the docker as shown below.

We can also get the IP by docker inspect command as shown below.

Now use the curl command to check whether the client is able to reach the site as shown below.

The webserver is now setup on the top of the docker.

HOPE YOU LEARNED AND ENJOYED CREATING THE SETUP.

--

--

Rishabh Jain
Rishabh Jain

Written by Rishabh Jain

I am a tech enthusiast, researcher and an integration seeker. I love to explore and learn about the right technology and right concepts from its foundation.

No responses yet