NES for PHP 7 Container Images
Pull the NES for PHP images, drop-in replacements for the official php images, on Debian 12, UBI 8 and UBI 9.
The NES for PHP 7 images are drop-in replacements for the official php images for
PHP 7.4 and 7.2 (the cli, fpm and apache variants): the same
entrypoints, commands, ports, PHP_INI_DIR, docker-php-ext-* helpers and
www-data user. In a Dockerfile, change the FROM line and nothing else in the
PHP setup.
The official PHP 7 images are on an older Debian (Debian 11 for PHP 7.4) and the NES Debian images on Debian 12, so a Dockerfile's apt-get install lines may need Debian 12 package names (for example libssl3 for libssl1.1). The images are also available on UBI 8 and UBI 9.
Images and tags
Every image is in registry.nes.herodevs.com/nes/php-nes. Each image's version is its release without the
v, and its tag is that version, the variant and the base:
<image version>-<variant>-<base>. A tag names one release of one image and
never moves. The current tags:
| Base | Variant | PHP 7.4 | PHP 7.2 |
|---|---|---|---|
| Debian 12 | cli | 7.4.33-nes-7.4.4-cli-bookworm | 7.2.34-nes-7.2.2-cli-bookworm |
| Debian 12 | fpm | 7.4.33-nes-7.4.4-fpm-bookworm | 7.2.34-nes-7.2.2-fpm-bookworm |
| Debian 12 | apache | 7.4.33-nes-7.4.4-apache-bookworm | 7.2.34-nes-7.2.2-apache-bookworm |
| UBI 8 | cli | 7.4.33-nes-7.4.4-cli-ubi8 | 7.2.34-nes-7.2.2-cli-ubi8 |
| UBI 8 | fpm | 7.4.33-nes-7.4.4-fpm-ubi8 | 7.2.34-nes-7.2.2-fpm-ubi8 |
| UBI 8 | apache | 7.4.33-nes-7.4.4-apache-ubi8 | 7.2.34-nes-7.2.2-apache-ubi8 |
| UBI 9 | cli | 7.4.33-nes-7.4.4-cli-ubi9 | 7.2.34-nes-7.2.2-cli-ubi9 |
| UBI 9 | fpm | 7.4.33-nes-7.4.4-fpm-ubi9 | 7.2.34-nes-7.2.2-fpm-ubi9 |
| UBI 9 | apache | 7.4.33-nes-7.4.4-apache-ubi9 | 7.2.34-nes-7.2.2-apache-ubi9 |
The registry serves each image under its release tag only: the official
images' moving tags, such as 7.4-fpm, have no NES counterpart. To update
to a new NES for PHP release, change the tag to the new release's.
Access
The images are in the NES registry at registry.nes.herodevs.com, which
requires a HeroDevs access token. See Access for how to get one.
Pull an image
Log in with your contact e-mail and your access token as the password:
docker login registry.nes.herodevs.com -u <your-contact-email>
then pull the images you use, with the tags from the table above:
# PHP 7.4
docker pull registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.4-cli-bookworm
docker pull registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.4-fpm-bookworm
docker pull registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.4-apache-bookworm
# PHP 7.2
docker pull registry.nes.herodevs.com/nes/php-nes:7.2.34-nes-7.2.2-cli-bookworm
docker pull registry.nes.herodevs.com/nes/php-nes:7.2.34-nes-7.2.2-fpm-bookworm
docker pull registry.nes.herodevs.com/nes/php-nes:7.2.34-nes-7.2.2-apache-bookworm
In a Dockerfile, replace the official image with the NES image of the same variant and PHP version, for example:
| Official image | NES image |
|---|---|
php:7.4-fpm | registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.4-fpm-bookworm |
php:7.2-fpm | registry.nes.herodevs.com/nes/php-nes:7.2.34-nes-7.2.2-fpm-bookworm |
FROM registry.nes.herodevs.com/nes/php-nes:<tag>
In Kubernetes, give the pods a pull secret:
kubectl create secret docker-registry herodevs-registry \
--docker-server=registry.nes.herodevs.com \
--docker-username=<your-contact-email> \
--docker-password=<your-nes-access-token>
and name it in the pod spec's imagePullSecrets.
Check the image
php -v shows PHP <version>-nes, and the image's
org.opencontainers.image.version label is the image version:
docker run --rm registry.nes.herodevs.com/nes/php-nes:<tag> php -v
docker image inspect registry.nes.herodevs.com/nes/php-nes:<tag> | grep org.opencontainers.image.version
Load from a tar
A host that cannot reach the registry can take an image as a file. On a host that can, pull the image and save it with its checksum:
tag=<tag>
docker pull registry.nes.herodevs.com/nes/php-nes:$tag
docker save -o nes-php-$tag.tar registry.nes.herodevs.com/nes/php-nes:$tag
sha256sum nes-php-$tag.tar > nes-php-$tag.tar.sha256
Copy both files to the other host, then check and load the image:
sha256sum -c nes-php-$tag.tar.sha256
docker load -i nes-php-$tag.tar
PHP 7.4: an image tar from HeroDevs, php-nes-<base>-<variant>-<image version>-<architecture>.tar
with its .sha256 file, is checked and loaded the same way. It holds one image,
tagged php-nes:<image version>-<variant>-<base>; tag it as your deployments
name it, for example docker tag php-nes:<tag> registry.nes.herodevs.com/nes/php-nes:<tag>.
The UBI images
The UBI images give the official images' interface on Red Hat's base, with these differences:
- They use
microdnf, notapt-get, so a Dockerfile's package installation lines change. The apache variant runs Red Hat's httpd (/etc/httpd), withAPACHE_RUN_USERand the other official variables. - The core extensions (ctype, curl, dom, json, mbstring, mysqlnd, pdo, xml and
the rest of the official set) load from ini files in
conf.d, where the official images build them in. Mounting a directory overconf.d, aPHP_INI_SCAN_DIRthat replaces the scan directory, orphp -nleaves them out: mount single files intoconf.d, or add to the scan directory (:/extra). pcntlis built into the CLI only: php-fpm and Apache do not load it.- PEAR's system configuration is
/etc/pear.conf.