Configuring HTTPD server on Docker Container
I am going to show how to configure a httpd server ( Apache httpd server ) on a centos container and later create an own docker container image.
Step 1 : Starting Docker Engine
In my case I am using RHEL-8 ( Redhat Enterprise Linux 8 ) Operating system as docker host so I need to run systemctl start docker.
We can verify with the command systemctl status docker to see if the service is started or not.
Step 2 : Launch a Docker Container
We can use docker ps to check if any container is running , in my case there is no container running. docker images to check which container images are available locally. If you cannot find any local images you can run the following command : docker pull centos.
Step 3 : Install all the necessary packages
Step 4 : Start the httpd service
Step 5 : Get the IP address
Step 6 : Test the Webserver
Finally we can put our container in background mode and use the command docker commit container_name username/image_name:version to create your own container image.