docker run -it -p 8080:80 -v "$PWD":/var/www/html/ martinmajlis/apache-php-rewrite:latest to run Apache with PHP and mod_rewrite from your current folder.
I have my side project to convert timestamp to date that I have written in PHP several years ago. Today I wanted to make some modifications there but I have no longer Apache installed. Furthermore it was always time consuming to setup everything. Therefore I have decided to use docker to make my life easier.
Dockerfile to achieve that is really simple:
FROM php:7-apache RUN a2enmod rewrite CMD ["apache2-foreground"]
However, there is no need to create such docker file, since you can use pre-build docker images:
How To Use It
It’s very simple to use those docker images. Just traverse to the folder with the project and then execute following command:
docker run -it -p 8080:80 \ -v "$PWD":/var/www/html/ \ martinmajlis/apache-php-rewrite:latest
Then you can access http://localhost:8080 and see your web in action. To make your development simpler, you can put something like:
/etc/hosts and then you can go to http://timestamp.test:8080.