This is an old revision of the document!
Table of Contents
Docker - Run Apache server
Let’s launch an Ubuntu container and install Apache inside of it using the bash prompt:
docker run -t -i ubuntu /bin/bash
The -t and -i flags allocate a pseudo-tty and keep stdin open even if not attached. This will allow you to use the container like a traditional VM as long as the bash prompt is running. Install Apache with apt-get update && apt-get install apache2. You’re probably wondering what address you can connect to in order to test that Apache was correctly installed…we’ll get to that after we commit the container.
…………………………………………..
There is an official image for apache. The image documentation contains instructions in how you can use this official images as a base for a custom image.
To see how it's done take a peek at the Dockerfile used by the official image:
https://github.com/docker-library/httpd/blob/master/2.4/Dockerfile
Example
Ensure files are accessible to root
sudo chown -R root:root /path/to/html_files
Host these files using official docker image
docker run -d -p 80:80 --name apache -v /path/to/html_files:/usr/local/apache2/htdocs/ httpd:2.4
Files are accessible on port 80.