From official repository php with apache and mod rewrite but slimed https://hub.docker.com/_/php
303
gruposoledad/php:7.4.26-apache-bullseye-slimDockerfileThis image contains Debian's Apache httpd in conjunction with PHP (as mod_php) and uses mpm_prefork by default. Apache with a Dockerfile
FROM gruposoledad/php:7.4.26-apache-bullseye-slim
COPY src/ /var/www/html/Where src/ is the directory containing all your PHP code. Then, run the commands to build and run the Docker image:
$ docker build -t my-php-app .
$ docker run -d --name my-running-app my-php-app
We recommend that you add a php.ini configuration file; see the "Configuration" section for details. Apache without a Dockerfile
Dockerfile$ docker run -d -p 80:80 --name my-apache-php-app -v "$PWD":/var/www/html gruposoledad/php:7.4.26-apache-bullseye-slimDocumentRoot (or other Apache configuration)Some applications may wish to change the default DocumentRoot in Apache (away from /var/www/html). The following demonstrates one way to do so using an environment variable (which can then be modified at container runtime as well):
FROM gruposoledad/php:7.4.26-apache-bullseye-slim
ENV APACHE_DOCUMENT_ROOT /path/to/new/root
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
A similar technique could be employed for other Apache configuration options.
Content type
Image
Digest
Size
28.6 MB
Last updated
almost 5 years ago
docker pull gruposoledad/php:8.0.13-apache-bullseye-slim