NES for PHP 7 Container Images
Pull the NES for PHP images, drop-in replacements for the official php images, on Debian 12, Red Hat UBI 8 and 9, or Alpine Linux.
The NES for PHP 7 images are drop-in replacements for the official php images for
PHP 7.4 (the cli, fpm and apache variants), with release v7.4.33-nes-7.4.3: 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.4 images are on Debian 11 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 Red Hat UBI 8 and 9, and on Alpine Linux (Alpine 3.22 and Alpine 3.24, cli and fpm).
Images and tags
Every image is in registry.nes.herodevs.com/nes/php-nes. Each image's version is its release without the
v, 7.4.33-nes-7.4.3, and its tag is that version, the variant and the base:
7.4.33-nes-7.4.3-<variant>-<base>. A tag names one release of one image and
never moves.
| Base | Variant | Release tag |
|---|---|---|
| Debian 12 | cli | 7.4.33-nes-7.4.3-cli-bookworm |
| Debian 12 | fpm | 7.4.33-nes-7.4.3-fpm-bookworm |
| Debian 12 | apache | 7.4.33-nes-7.4.3-apache-bookworm |
| UBI 8 | cli | 7.4.33-nes-7.4.3-cli-ubi8 |
| UBI 8 | fpm | 7.4.33-nes-7.4.3-fpm-ubi8 |
| UBI 8 | apache | 7.4.33-nes-7.4.3-apache-ubi8 |
| UBI 9 | cli | 7.4.33-nes-7.4.3-cli-ubi9 |
| UBI 9 | fpm | 7.4.33-nes-7.4.3-fpm-ubi9 |
| UBI 9 | apache | 7.4.33-nes-7.4.3-apache-ubi9 |
| Alpine 3.22 | cli | 7.4.33-nes-7.4.3-cli-alpine3.22 |
| Alpine 3.22 | fpm | 7.4.33-nes-7.4.3-fpm-alpine3.22 |
| Alpine 3.24 | cli | 7.4.33-nes-7.4.3-cli-alpine3.24 |
| Alpine 3.24 | fpm | 7.4.33-nes-7.4.3-fpm-alpine3.24 |
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. If you do not have an access token, contact
support@herodevs.com. For more information see
Access Tokens.
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:
docker pull registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.3-cli-bookworm
docker pull registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.3-fpm-bookworm
docker pull registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.3-apache-bookworm
In a Dockerfile, replace the official image with the NES image of the same
variant, for example php:7.4-fpm with:
FROM registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.3-fpm-bookworm
or, for the official Alpine image, php:7.4-fpm-alpine, the NES image on the
newest Alpine release:
FROM registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.3-fpm-alpine3.24
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 7.4.33-nes, and the image's
org.opencontainers.image.version label is the image version,
7.4.33-nes-7.4.3:
docker run --rm registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.3-fpm-bookworm php -v
docker image inspect registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.3-fpm-bookworm | 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:
docker pull registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.3-fpm-bookworm
docker save -o nes-php-7.4.33-nes-7.4.3-fpm-bookworm.tar registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.3-fpm-bookworm
sha256sum nes-php-7.4.33-nes-7.4.3-fpm-bookworm.tar > nes-php-7.4.33-nes-7.4.3-fpm-bookworm.tar.sha256
Copy both files to the other host, then check and load the image:
sha256sum -c nes-php-7.4.33-nes-7.4.3-fpm-bookworm.tar.sha256
docker load -i nes-php-7.4.33-nes-7.4.3-fpm-bookworm.tar
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:7.4.33-nes-7.4.3-fpm-bookworm registry.nes.herodevs.com/nes/php-nes:7.4.33-nes-7.4.3-fpm-bookworm
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.
The Alpine images
The Alpine images are the official Alpine images' build, on a supported Alpine release, with these points to know:
- They use musl, not glibc, and
apk, notapt-get, so a Dockerfile's package installation lines are the ones it uses with the official Alpine image. www-datais Alpine's user and group 82, as in the official Alpine images.iconvis GNU libiconv, as in the official Alpine images (musl's own iconv cannot transliterate).docker-php-ext-configure,docker-php-ext-installanddocker-php-ext-enableinstall the build tools they need from Alpine's repositories and remove them after, so a build that uses them needs Alpine's repositories. Beforepecl installorphpize, add the tools yourself:apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS.- musl behaves as in the official Alpine images: there is no
GLOB_BRACEforglob()and no IDN flags (AI_IDNand the rest) forsocket_addrinfo_lookup();setlocale()accepts any locale but locales other than C and UTF-8 change nothing (number, money and character-class formatting stay C's);strftime()leaves%Zempty for a time zone PHP set;crypt()returns*for a rejected salt, where glibc returns*0; andimap_utf8_to_mutf7()andimap_mutf7_to_utf8()are not available when ext/imap is built against Alpine's c-client. - There is no
apachevariant on Alpine, as there was none in the official images.