Visit NES for PHP Home Page

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.

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:

BaseVariantPHP 7.4PHP 7.2
Debian 12cli7.4.33-nes-7.4.4-cli-bookworm7.2.34-nes-7.2.2-cli-bookworm
Debian 12fpm7.4.33-nes-7.4.4-fpm-bookworm7.2.34-nes-7.2.2-fpm-bookworm
Debian 12apache7.4.33-nes-7.4.4-apache-bookworm7.2.34-nes-7.2.2-apache-bookworm
UBI 8cli7.4.33-nes-7.4.4-cli-ubi87.2.34-nes-7.2.2-cli-ubi8
UBI 8fpm7.4.33-nes-7.4.4-fpm-ubi87.2.34-nes-7.2.2-fpm-ubi8
UBI 8apache7.4.33-nes-7.4.4-apache-ubi87.2.34-nes-7.2.2-apache-ubi8
UBI 9cli7.4.33-nes-7.4.4-cli-ubi97.2.34-nes-7.2.2-cli-ubi9
UBI 9fpm7.4.33-nes-7.4.4-fpm-ubi97.2.34-nes-7.2.2-fpm-ubi9
UBI 9apache7.4.33-nes-7.4.4-apache-ubi97.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:

Debian 12
UBI 8
UBI 9
# 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 imageNES image
php:7.4-fpmregistry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.4-fpm-bookworm
php:7.2-fpmregistry.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, not apt-get, so a Dockerfile's package installation lines change. The apache variant runs Red Hat's httpd (/etc/httpd), with APACHE_RUN_USER and 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 over conf.d, a PHP_INI_SCAN_DIR that replaces the scan directory, or php -n leaves them out: mount single files into conf.d, or add to the scan directory (:/extra).
  • pcntl is built into the CLI only: php-fpm and Apache do not load it.
  • PEAR's system configuration is /etc/pear.conf.