The mod_wsgi-docker package is a companion package for Apache/mod_wsgi. It
contains configurations for building docker images which bundle up Apache
Prebuilt images available are:
on Docker Hub for more information.
How to use these images
Dockerfile in your Python web application project::
FROM grahamdumpleton/mod-wsgi-docker:python-2.7-onbuild CMD [ "hello.wsgi" ]
The list of
CMD arguments should consist of the path to the WSGI script
file for the Python web application and any additional arguments you wish
to have supplied to the
These 'onbuild' images include multiple
ONBUILD triggers, which should
be all you need to bootstrap most applications. The build will
current directory into
/app and then
RUN pip install on any
requirements.txt file. It is possible to define pre and post hooks to
enable additional system packages to be installed and for additional
application setup to be performed.
You can then build and run the Docker image::
docker build -t my-python-app . docker run -it --rm -p 8000:80 --name my-running-app my-python-app
The Python web application should then be accessible at port 8000 of the
Note that although your specific Python web application when run will run
as the non root user
whiskey, the Apache server itself will initially
start up as the root user. Some Docker runtime environments however may be
set up so as to prohibit you running your container as the root user and
require a non root user from the outset.
If this is the case, you can use::
FROM grahamdumpleton/mod-wsgi-docker:python-2.7-onbuild USER $MOD_WSGI_USER:$MOD_WSGI_GROUP CMD [ "hello.wsgi" ]
For additional examples see the 'demos' sub directory.