Testing PHP 7.2 With Docker

Elephpant with hard hat

PHP 7.2 is slated for release in November 2017, but you don't have to wait until then to start testing your applications! We can easily use Docker to test against the latest pre-release versions of 7.2.

PHP 7.2 Pre-Release Images

PHP now has official pre-release Docker builds available. You should use those instead.

I've created a PHP 7.2 pre-release image on Docker Hub: https://hub.docker.com/r/colinodell/php-7.2/.

It's based directly on the official PHP 7.1 images, so if you're already using those it should be painless to try 7.2 instead: simply use colinodell/php-7.2.

Here's a full list of the available tags for colinodell/php-7.2:

  • latest
  • alpine
  • apache
  • fpm
  • fpm-alpine
  • zts
  • zts-alpine

Specific versions like alpha3 can also be specified; for example:

  • alpha3
  • alpha3-alpine
  • alpha3-apache
  • alpha3-fpm
  • alpha3-fpm-alpine
  • alpha3-zts
  • alpha3-zts-alpine

(alpha1 and alpha2 are not available due to compilation errors)


If you find bugs in these PHP 7.2 pre-releases, please report them to the official PHP bug tracker: https://bugs.php.net

Otherwise, if you find any other issues with the Docker images themselves, feel free to report them here: https://github.com/colinodell/docker-php-7.2-prerelease/issues/new


The mcrypt extension was moved from core to PECL, so you can no longer install it like this:

docker-php-ext-install -j$(nproc) mcrypt

You must instead install it from PECL:

yes '' | pecl install -f mcrypt
echo "extension=mcrypt.so" > /usr/local/etc/php/conf.d/mcrypt.ini

Future Releases

I plan on updating this with every future pre-release for PHP 7.2 (including betas and release candidates). However, it's extremely unlikely that I'll create builds for stable releases of PHP 7.2.0: you should obtain those from the official repository instead.

Enjoy this article?

About Colin O'Dell

Colin O'Dell

Colin O'Dell is a Senior Software Engineer at SeatGeek. In addition to being an active member of the PHP League and maintainer of the league/commonmark project, Colin is also a PHP docs contributor, conference speaker, and author of the PHP 7 Migration Guide.