Public | Automated Build

Last pushed: 3 months ago
Short Description
Laravel PHP framework running on Apache (with SSL support), built on Debian
Full Description

README

This is a Laravel application server image based on Apache (with SSL support) and PHP5. In order to use this image effectively, you'll need to mount:

  • /var/www/laravel/{app,public,vendor}/ for your app code (e.g. using "-v /home/jdoe/myapp/app/:/var/www/laravel/app/ -v /home/jdoe/myapp/public/:/var/www/laravel/public/" for a site with app content and public content, but no vendor content)
  • /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 app code at /home/jdoe/myapp/, 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.

  • Default Laravel splash page: docker run -p 80:80 -p 443:443 -d eboraas/laravel and browse to the host's IP address using http or https
  • Serving your own app, with SSL support: docker run -p 80:80 -p 443:443 -v /home/jdoe/myapp/app/:/var/www/laravel/app/ -v /home/jdoe/myapp/public/:/var/www/laravel/public/ -d eboraas/laravel
  • ... without SSL support: docker run -p 80:80 -v /home/jdoe/myapp/app/:/var/www/laravel/app/ -v /home/jdoe/myapp/public/:/var/www/laravel/public/ -d eboraas/laravel
  • ... using non-standard ports: docker run -p 8080:80 -p 8443:443 -v /home/jdoe/myapp/app/:/var/www/laravel/app/ -v /home/jdoe/myapp/public/:/var/www/laravel/public/ -d eboraas/laravel
Docker Pull Command
Owner
eboraas
Source Repository

Comments (21)
ikasetebo
4 months ago

Hey, So I mounted my directories. But I get a 'Forbidden You don't have permission to access / on this server. Server unable to erad htaccess file, denying access to be safe' I tried messing around with my apach2.conf with the Directory Block and still nothing.

darthvader
7 months ago

Como faço para habilitar o curl?

smagic39
9 months ago

show me how to change version laravel

ldhqy
a year ago

I want to add the mysql server(Any version) into this image,How to write the contents of the Dockerfile?

kji0205
a year ago

Thank you very much!!

greggy
a year ago

To overcome the httpd already running issue, I mount an extra directory where the apache2.pid is written. So, add the option: -v /home/me/site/testpid:/var/run/apache2 . Just remove the apache2.pid file and run docker start <your container>.

It would also be nice to have php5-gd already build in; the same for the eboraas/apache-php ;-)

bmeeder22
a year ago

I also get the httpd (pid 6) already running error

lovechaninbetter
a year ago

Cannot start container again after stopped.

Error : httpd (pid 6) already running

How can i fix it?

enderandpeter
a year ago

Sorry, I just now noticed the earlier exchange between you and conve. Yes, I'm seeing the very same behavior, either on restart or stopping and starting. I'm using a docker context that installs programs and adds an httpd conf for setting the server name, but nothing too involved.

enderandpeter
a year ago

This is an excellent container. Thank you for putting it together.

My only concern is that whenever this container is restarted, it is not able to start back up again, and docker [container_name] logs shows the error httpd (pid 6) already running. It won't let me do docker [container_name] top] because the container is constantly restarting rather than in a state where you can look at its processes. I am only able to get it going again after stopping, removing, and then re-running the container. Might you be aware of this issue?