PHP is a server-side scripting language designed for web development, but which can also be used as a general-purpose programming language. PHP can be added to straight HTML or it can be used with a variety of templating engines and web frameworks. PHP code is usually processed by an interpreter, which is either implemented as a native module on the web-server or as a common gateway interface (CGI).
7.4.0-cli-alpine3.9
,7.4-cli-alpine3.9
,7-cli-alpine3.9
,cli-alpine3.9
,7.4.0-alpine3.9
,7.4-alpine3.9
,7-alpine3.9
,alpine3.9
,7.4.0-cli
,7.4-cli
,7-cli
,cli
,7.4.0
,7.4
,7
,latest
(7.4/alpine/3.9/cli/Dockerfile)7.4.0-fpm-alpine3.9
,7.4-fpm-alpine3.9
,7-fpm-alpine3.9
,fpm-alpine3.9
,7.4.0-fpm
,7.4-fpm
,7-fpm
,fpm
(7.4/alpine/3.9/fpm/Dockerfile)7.4.0-roadrunner-alpine3.9
,7.4-roadrunner-alpine3.9
,7-roadrunner-alpine3.9
,roadrunner-alpine3.9
,7.4.0-roadrunner
,7.4-roadrunner
,7-roadrunner
,roadrunner
(7.4/alpine/3.9/roadrunner/Dockerfile)7.4.0-aio-alpine3.9
,7.4-aio-alpine3.9
,7-aio-alpine3.9
,aio-alpine3.9
,7.4.0-aio
,7.4-aio
,7-aio
,aio
(7.4/alpine/3.9/aio/Dockerfile)
7.3.4-cli-alpine3.9
,7.3-cli-alpine3.9
,7.3.4-alpine3.9
,7.3-alpine3.9
,7.3.4-cli
,7.3-cli
,7.3.4
,7.3
(7.4/alpine/3.9/cli/Dockerfile)7.3.4-fpm-alpine3.9
,7.3-fpm-alpine3.9
,7.3.4-fpm
,7.3-fpm
(7.3/alpine/3.9/fpm/Dockerfile)7.3.4-roadrunner-alpine3.9
,7.3-roadrunner-alpine3.9
,7.3.4-roadrunner
,7.3-roadrunner
(7.3/alpine/3.9/roadrunner/Dockerfile)7.3.4-aio-alpine3.9
,7.3-aio-alpine3.9
,7.3.4-aio
,7.3-aio
(7.3/alpine/3.9/aio/Dockerfile)7.3.3-cli-alpine3.8
,7.3-cli-alpine3.8
,7-cli-alpine3.8
,cli-alpine3.8
,7.3.3-alpine3.8
,7.3-alpine3.8
,7-alpine3.8
,alpine3.8
(7.3/alpine/3.8/cli/Dockerfile)7.3.3-fpm-alpine3.8
,7.3-fpm-alpine3.8
,7-fpm-alpine3.8
,fpm-alpine3.8
(7.3/alpine/3.8/fpm/Dockerfile)7.3.3-aio-alpine3.8
,7.3-aio-alpine3.8
,7-aio-alpine3.8
,aio-alpine3.8
(7.3/alpine/3.8/aio/Dockerfile)
7.2.17-cli-alpine3.9
,7.2-cli-alpine3.9
,7.2.17-alpine3.9
,7.2-alpine3.9
,7.2.17-cli-alpine
,7.2-cli-alpine
,7.2.17-alpine
,7.2-alpine
(7.2/alpine/3.9/cli/Dockerfile)7.2.17-fpm-alpine3.9
,7.2-fpm-alpine3.9
,7.2.17-fpm-alpine
,7.2-fpm-alpine
(7.2/alpine/3.9/fpm/Dockerfile)7.2.17-aio-alpine3.9
,7.2-aio-alpine3.9
,7.2.17-aio-alpine
,7.2-aio-alpine
(7.2/alpine/3.9/aio/Dockerfile)7.2.16-cli-alpine3.8
,7.2-cli-alpine3.8
,7.2.16-alpine3.8
,7.2-alpine3.8
(7.2/alpine/3.8/cli/Dockerfile)7.2.16-fpm-alpine3.8
,7.2-fpm-alpine3.8
(7.2/alpine/3.8/fpm/Dockerfile)7.2.16-aio-alpine3.8
,7.2-aio-alpine3.8
(7.2/alpine/3.8/aio/Dockerfile)
7.1.17-fpm-alpine3.7
,7.1-fpm-alpine3.7
,7.1.17-fpm-alpine
,7.1-fpm-alpine
(7.1/alpine/3.7/fpm/Dockerfile)
The php
images come in many flavors, each designed for a specific use case.
This variant contains the PHP CLI tool with default mods. If you need a web server, this is probably not the image you are looking for. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as a base from which to build other images.
This variant contains PHP-FPM, which is a FastCGI implementation for PHP. See the PHP-FPM website for more information about PHP-FPM.
In order to use this image variant, some kind of reverse proxy (such as NGINX, Apache, or other tool which speaks the FastCGI protocol) will be required.
Some potentially helpful resources:
- PHP-FPM.org
- simplified example by @md5
- very detailed article by Pascal Landau
- Stack Overflow discussion
- Apache httpd Wiki example
This image is based on the popular Alpine Linux project, available in the alpine
official image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See this Hacker News comment thread for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.
To minimize image size, it's uncommon for additional related tools (such as git
or bash
) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the alpine
image description for examples of how to install packages if you are unfamiliar).