# Create an HTTP server on Docker

In 
Published 2022-12-03

This tutorial explains to you how to create an HTTP server on Docker container. This tutorial has an example as well.

If you want to create a Docker container on which you want to deploy something, you need to have a Docker image. Each Docker container is based on a Docker image.

At this point we have a Docker container created from a CentOS 7 based image. In order to obtain this image you have to read the article named Create a Linux container with Docker.

Take a look at the following picture:

The container is created and has 2dabda2d464a as ID. This container have got a network address (172.17.0.3).

We have access to the Internet, so we can install the http server from Docker Hub using the yum command:

You see the packages needed and the dependencies. You have to accept and go further.

Click on "y" again to continue with the installation.

At this point the HTTP Server on CentOS 7 Docker container is completed. Now we have to star the HTTP Server using the following command:

/usr/sbin/httpd -k start

You can ignore the message above if you just want to know how to quickly install and start an HTTP Server into a Docker Container.

Now you can test the HTTP Server from the host machine (where Docker is running):

Now you are sure your HTTP Server is running and can be used.