apache in docker to serve local website

I have some backup’s of website on my laptop, which I occasionally want to view. Now, I could have setup apache to serve them directly with VirtualHost or alias but wanted a better solution. So, docker comes to rescue.

First, I installed fedora-dockerfiles and then made some modifications, here they are :

sudo yum install fedora-dockerfiles

After this is done, go to /usr/share/fedora-dockerfiles/apache and make some modification to Dockerfile.  After the modifications, the file looks like this

FROM fedora
MAINTAINER “Scott Collier” <scollier@redhat.com>

RUN yum -y update; yum clean all
RUN yum -y install httpd; yum clean all
RUN echo “Apache” >> /var/www/html/index.html


# Simple startup script to avoid some issues observed with container restart
ADD run-apache.sh /run-apache.sh
ADD php.conf /etc/httpd/conf.d/php.conf
RUN chmod -v +x /run-apache.sh
RUN yum -y install php

CMD [“/run-apache.sh”]


Now copy the php.conf file to current directory.

sudo cp /etc/httpd/conf.d/php.conf .

#Build the docker image
docker build --rm -t apache .

#and then quickly test the image like this -
docker run -t -i --rm -p 80:80 apache

#open the site in firefox
firefox -new-tab http://loccalhost

Once you see that the docker is running fine, time to create a script to do this in your desired directory.
I always have “~/bin” in $PATH, so I created ~/bin/docker.sh file with the following contents:

#!/bin/bash -
#          FILE: docker_firefox.sh
#         USAGE: ./docker_firefox.sh
#       OPTIONS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka)
#      REVISION:  ---

echo "Run Ubu website:::"
CID=$(docker run  -d -p 80:80  -v $dir:/var/www/html:ro apache)
echo docker CID is $CID
firefox -new-tab http://localhost/index.php

After this time to test:

Just run this script and you should have the contents of current directory in your browser.

Apache server-status – better looking

Apache provides a module to see the server-status. However the page is not too good looking. So, if you want to see a better looking information page, then you can download :


More details from the readme file of the project:


* On the system you want to install the pimped Apache status:
– any webserver with php 5 (with curl; no database is needed)
* On all webservers you want to monitor:
– apache 2.x
– installed module mod_status and ExtendedStatus On
– permission for the monitoring server to request the the
alias /server-status (see below)

And tehn for installation:

1. Extract the files somewhere below webroot on your webserver. You
can put to any subdirectory. It is not a must to have it in the
— OR —
checkout sources with svn client:
cd [webroot-directory]
svn checkout http://svn.code.sf.net/p/pimpapachestat/code/trunk apachestatus
2. Allow your server to access the server-status page on the systems
you want to monitor
<Location /server-status>
SetHandler server-status
order deny, allow
allow from
allow from # enter ip of your monitoring system
deny from all
3. Open http://localhost/apachestatus/ in your webbrowser.
4. In ./conf/ directory: open config_user.php and setup the systems you want
to monitor. See config_default.php to see other thing you could override

Note: If you are using latest apache version then the <Location> entry should be :

<Location /server-info>
SetHandler server-info
Require all granted

* change or add language: see readme in subdirectory ./lang/
* change theme:
– make copy ./templates/default/
– make changes in style.css and out_html.php in your copy
– set skin in ./conf/config_user.php:
$aUserCfg = array(
‘skin’ => ‘name_of_subdir’,

If you have a language or a theme to share then send it to me.


Inotify Example: Introduction to Inotify with a C Program Example

Inotify Example: Introduction to Inotify with a C Program Example:

inotify utility is an effective tool to monitor and notify filesystem changes. You can specify a list of files and directories that needs to be monitored by inotify. This library is used by various other programs. For example, CPAN module Linux::Inotify is developed based on this library.
iNotify Execution Flow

On a high-level, you do the following with inotify utility.