Table of Contents
In this tutorial, I will use Docker to install an apache web server. How to set up Apache web server in a Docker container. Now, let go Docker install Apache Web Server.
Docker as a platform container. I will install Docker on Debian/Ubuntu and install Apache 2.4 container from Docker Hub.
Install Docker on Ubuntu here
Setting up the Apache Docker Container
For example, I will install Apache 2.4 container named devops-roles. Use an image called httpd:2.4 from Docker Hub. and detached from the current terminal.
Host port is 8080 to be redirected to guest port 80 on the container. I will serve a simple web page form /home/vagrant/website.
Docker install Apache web server
docker run -itd --name devops-roles -p 8080:80 -v /home/vagrant/website/:/usr/local/apache2/htdocs/ httpd:2.4
Check Docker Apache container running as command below
To created index.html file inside /home/vagrant/website directory.
sudo vi /home/vagrant/website/index.html
The content as below
<title>Learn Docker at DevopsRoles.com</title>
<h1>Learn Docker With DevopsRoles.com</h1>
Open web browser type server-ip:8080/index.html
The output terminal as below
Now, you can stop docker container apache
docker stop devops-roles
and remove it:
docker rm devops-roles
You can clean up and delete the image that was used in the container.
docker image remove httpd:2.4
You have to Docker install Apache Web Server. I hope will this your helpful. Thank you for reading the DevopsRoles page!