Docker image for running PHP apps in a single container with nginx and PHP-fpm
10K+
Docker image for running PHP apps in a single container with nginx and PHP-fpm
For basic usage with no further extensions, you just copy your sources to /app
FROM timoreymann/php-app
COPY --chown=application:application ./code /app
When you use composer for external dependencies you can easily install them in the build process.
The composer-install script downloads the installer from GitHub, installs the depencies and removes the phar file.
FROM timoreymann/php-app
WORKDIR /app
COPY --chown=application:application ./code ./
RUN composer-install
When you build a modern web app with PHP, chances are high that you will have routing within your index.php. To make it work, nginx needs to route all requests to the index.php, if the file does not exist in the webroot (e.g. assets).
FROM timoreymann/php-app
WORKDIR /app
COPY --chown=application:application ./code ./
RUN composer-install && configure-index-rewrite
For the CVEs CVE-2026-109618 and CVE-2026-109619 ("PHP2Shell") you can block every request with a multipart content type before it reaches PHP. This breaks all file uploads. Use it only until your PHP version contains the fix.
FROM timoreymann/php-app
WORKDIR /app
COPY --chown=application:application ./code ./
RUN block-multipart
The script keeps the setting after a rebuilt image only if you run the script again.
Remove the RUN block-multipart line from your Dockerfile after PHP published the fix and rebuild.
The image consists of:
PHP 8 extensions that are common are also pre-installed:
I love your input! I want to make contributing to this project as easy and transparent as possible, whether it's:
To get started please read the Contribution Guidelines.
Content type
Image
Digest
sha256:4e5b39def…
Size
37 MB
Last updated
6 days ago
docker pull timoreymann/php-app