In this blog post, we will learn how to run an Apache webserver inside a Docker container.
Apache Web Server is the #1 web server in the world and powers most of the web servers on the internet. With Docker, we can deploy Apache without needing to configure it on our host machine.
To download the latest Apache webserver container image, I will use the following command.
docker pull httpd
To deploy a Docker container with an Apache server I will use the following command.
The web server will be available on port 80.
docker run -d --name apache-web -p 80:80 httpd:latest
As you can see above the webserver is working. To access it I need to browse the Docker host IP address using port 80. If port 80 is used, you can use a different port like 8080. Use that port in the browser.
This blog post was first published on our sister site https://www.ntweekly.com