Public | Automated Build

Last pushed: 18 hours ago
Short Description
Apache (with SSL support), built on Debian
Full Description

README

This is a simple Apache image, including SSL support. In order to use this image effectively, you'll need to mount:

  • /var/www/html for your site content (e.g. using "-v /home/jdoe/mysite/:/var/www/html/")
  • /var/log/apache2, optionally, if you want to store logfiles visibly outside the container
  • /etc/ssl, optionally, if you wish to use SSL with real keys

A note on SSL

As per the defaults, Apache will use the bundled "snakeoil" key when serving SSL. Obviously this isn't sufficient or advisable for production, so you'll want to mount your real keys onto /etc/ssl/. If you name them "certs/ssl-cert-snakeoil.pem" and "private/ssl-cert-snakeoil.key", you'll be able to get by with the default config. Otherwise, you'll want to include a revised site definition. If you don't want to use SSL, you can avoid forwarding port 443 when launching the container (see below).

Simple Examples

Assuming you have your content at /home/jdoe/mysite/, the below will be sufficient to serve it. Note that many Docker users encourage mounting data from a storage container, rather than directly from the filesyetem.

  • "It works!": docker run -p 80:80 -p 443:443 -d eboraas/apache and browse to the host's IP address using http or https
  • Serving actual content with SSL support: docker run -p 80:80 -p 443:443 -v /home/jdoe/mysite/:/var/www/html/ -d eboraas/apache
  • ... without SSL support: docker run -p 80:80 -v /home/jdoe/mysite/:/var/www/html/ -d eboraas/apache
  • ... using non-standard ports: docker run -p 8080:80 -p 8443:443 -v /home/jdoe/mysite/:/var/www/html/ -d eboraas/apache
Docker Pull Command
Owner
eboraas
Source Repository

Comments (15)
safetip
a year ago

Any tips to use virtual hosts?

eboraas
a year ago

@docstreamadmin Apache is kept up to date against the current stable version of Debian. At this time, that means 2.4.10-10+deb8u4 (which is 2.4.10 with active security maintenance). It's updated daily to stay current with the latest fixes.

docstreamadmin
a year ago

Version is 2.4.10!

eboraas
a year ago

My apologies for the inexcusable delays in updating this image. All of the reported errors should now be fixed. Going forward, I am committing to keeping this image up-to-date and in good working order.

For those who are interested, while a number of the proposed solutions to the SHMCB issue would work, it seems that the best solution is actually the most obvious: I've updated the base image to use a2enmod instead of hand-creating the symlinks; this actually ensures that the SHMCB dependency is resolved automatically, enabling the module without any further steps. This is, in my mind, the simplest and most future-proof approach.

Thanks for all your feedback!

ludohelder
a year ago

Add this line to the docker file to fix the issue with the SSLSessionCache
RUN /bin/ln -sf ../mods-available/socache_shmcb.load /etc/apache2/mods-enabled/

maniankara
a year ago

Does it work for others?
I get errors.

anovil@anovil-Latitude-E6440:~/tmp/serverfault/docker/haproxy$ docker run -it eboraas/apache /bin/bash
root@ff105ba15d95:/# /usr/sbin/apache2ctl -D FOREGROUND
AH00526: Syntax error on line 43 of /etc/apache2/mods-enabled/ssl.conf:
SSLSessionCache: 'shmcb' session cache not supported (known names: ). Maybe you need to load the appropriate socache module (mod_socache_shmcb?).
Action '-D FOREGROUND' failed.
The Apache error log may have more information.
root@ff105ba15d95:/#

docker: 1.9.1
Host: ubuntu:14.04

stefanlehmann
2 years ago

maybe you could try rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* for making the image a bit smaller

themathcode
2 years ago

The bad thing is that their is an error that everybody is encountering yet the owner of this image doesn't update it.
Did cp /etc/apache2/mods-available/socache_shmcb.load /etc/apache2/mods-enabled/
but no positive results.

sterlingvix
2 years ago

For anyone with sps4's question: the Dockerfile at the project page shows the following ENV variables setting the Apache USER and RUNGROUP to www-data:

ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
linfan
2 years ago

The 'latest' image have some problem, it looks like mod_socache_shmcb.so is not loaded correctly:

Status: Downloaded newer image for eboraas/apache:latest
AH00526: Syntax error on line 43 of /etc/apache2/mods-enabled/ssl.conf:
SSLSessionCache: 'shmcb' session cache not supported (known names: ). Maybe you need to load the appropriate socache module (mod_socache_shmcb?).
Action '-D FOREGROUND' failed.
The Apache error log may have more information.