If you used docker, you might be loving the convenience of creating apps on the fly with little effort. You may be interested to install an apache http server. This guide will help to do this.
Pull apache docker image
[root@ubuntu /personal/apachetest]# docker images | grep httpd
[root@ubuntu /personal/apachetest]# docker pull httpd
Using default tag: latest
latest: Pulling from library/httpd
386a066cd84a: Pull complete
a11d6b8e2fac: Pull complete
c1fdc7beec37: Pull complete
bd14a67deca2: Pull complete
92b34ad02810: Pull complete
Digest: sha256:5b4a3c85b4b874e84174ee7e78a59920818aa39903f6a28a47b9278f576b4a4d
Status: Downloaded newer image for httpd:latest
[root@ubuntu /personal/apachetest]# docker images | grep httpd
httpd latest 50f10ef90911 12 days ago 193.3 MB
[root@ubuntu /personal/nstrace/cpx]#
Create a httpd docker instance
Below command creates an http docker instance for which current host directory(/personal/apachetest in this case) is the root directory. Note that we need to create index.html to current host directory
[root@ubuntu /personal/apachetest]# docker ps | grep apache
[root@ubuntu /personal/apachetest]# docker run -dit --name my-apache-app -p 80 -v "$PWD":/usr/local/apache2/htdocs/ httpd:latest
baef2d1920f46b5f0552edaa58123d5e02afb307f7bf86295d7842862d43c73d
[root@ubuntu /personal/nstrace/cpx]# docker ps | grep apache
baef2d1920f4 httpd:latest "httpd-foreground" 10 seconds ago Up 9 seconds 0.0.0.0:32828->80/tcp my-apache-app
Create index.html in the host current directory
Create a index.html file in the host current directory. This file will be returned for http query.
[root@ubuntu /personal/apachetest]# cat index.html
<html>
<head>
<title>Sample "Hello, World" Application</title>
</head>
<body bgcolor=white>
<table border="0" cellpadding="10">
<tr>
<td>
<img src="images/springsource.png">
</td>
<td>
<h1>Sample "Hello, World" Application</h1>
</td>
</tr>
</table>
<p>This is the home page for the HelloWorld Web application. </p>
<p>To prove that they work, you can execute either of the following links:
<ul>
<li>To a <a href="hello.jsp">JSP page</a>.
<li>To a <a href="hello">servlet</a>.
</ul>
</body>
</html>
Inspect apache container
Observe that httpd is running in the Apache container
[root@ubuntu /personal/apachetest]# docker exec -it my-apache-app bash
root@baef2d1920f4:/usr/local/apache2# ps ax
PID TTY STAT TIME COMMAND
1 ? Ss+ 0:00 httpd -DFOREGROUND
7 ? Sl+ 0:00 httpd -DFOREGROUND
8 ? Sl+ 0:00 httpd -DFOREGROUND
9 ? Sl+ 0:00 httpd -DFOREGROUND
91 ? Ss 0:00 bash
97 ? R+ 0:00 ps ax
You can get default config file at below location. To modify it, simply replace with modified config file
root@baef2d1920f4:/usr/local/apache2# ls /usr/local/apache2/conf/httpd.conf
/usr/local/apache2/conf/httpd.conf
Access to http server
Below command access http page. Note host machine IP (1.1.1.1) and my-apache-app port (32828). Also the returned file is index.html which is referred in above write-up.
root@ns# curl http:/1.1.1.1:32828
<html>
<head>
<title>Sample "Hello, World" Application</title>
</head>
<body bgcolor=white>
<table border="0" cellpadding="10">
<tr>
<td>
<img src="images/springsource.png">
</td>
<td>
<h1>Sample "Hello, World" Application</h1>
</td>
</tr>
</table>
<p>This is the home page for the HelloWorld Web application. </p>
<p>To prove that they work, you can execute either of the following links:
<ul>
<li>To a <a href="hello.jsp">JSP page</a>.
<li>To a <a href="hello">servlet</a>.
</ul>
</body>
</html>
https://hub.docker.com/_/httpd/
http://pubs.vmware.com/vfabric53/index.jsp?topic=/com.vmware.vfabric.tc-server.2.9/getting-started/tutwebapp-index-html-file.html