How to Configure HTTPD Server on Docker Container

The first step is to launch a container of your choice here centos is used for launching the container we have to first download the image using the command

After downloading the image we have to launch the container from the command

Here is the example

For getting the IP address of the container we have to run the ifconfig command but by default, it is not available in the centos docker container for using this command we have to install a software called net-tools. For installing software in centos we use dnf command.

So the command for installing net-tools is

Now we have done with the installation of net-tools software for verification we can run ifconfig command.

After this, we have to install the Apache webserver for this we can execute the command

We successfully are done with the installation of the Apache HTTPD Server on the top of the docker container. Now we have to configure the configuration directory for httpd server is /var/www/html where we have to put the static website data.

And the final step is to start the service. Generally in centos, we use systemctl command to start or stop the services but in the docker container, this command is not supported so instead of using systemctl we execute

to start the services.

Here we have done with the configuring the httpd web server on the docker container.

☺ Thanks for Reading

--

--

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