Open In App

Setup Web Server Over Docker Container in Linux

Last Updated : 04 May, 2020
Like Article

Before setting up a server we must know the real meaning or definition of a server. So, the Server is a program that provides the client with any kind of services. For example, a web server provides our websites, a database server provides us data. This means every server has work to do and for every different work we want them to do, we have to choose different servers.
For knowing more about servers and their working click here. To check more about dockers – click here.


  1. Linux Operating system Like Ubuntu, Redhat, Kali Linux.
  2. Internet connectivity
  3. Docker installed on system

What we are going to do VISUAL:

Let’s now understand the installation and configuration.

3 steps to configure a Web Server

  • Install the Server Program
  • Configuration of Server
  • Start the server

Installing the Server Software

Start docker services.

systemctl start docker

Open the docker container, you can use centos 7 images to launch.If you don’t have centos images you can download it from the

docker run -it --network host centos:7

We are going to use HTTPD server.It could be installed using YUM command and DNF if you are using RHEL 8.

yum install httpd

webserver installation

Configuring the Web server

Actually the server is already been configured and now its the time to update or make a website over this server.Server website can be accessed using the IP address of the host.
Setup website

cd /var/www/html/

In this directory you could save your website and it would be available over the network.

Start the server

systemctl start httpd

If this doesn’t start the server, try this


Access the content of website

To access the content of the webserver you must know the ip address, which could be known using “ifconfig” command.And then do the further steps.

 curl http://IP of host/page_name.html

Visit Webpage

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads