The flags have changed due to massiv update in the GD lib itself. The --with-png flag have been removed but png is supported by default. You don't need that flag anymore. ------ Use this docker-php-ext-configure flags to make it work for PHP 7.4, PHP 8.0 and PHP 8.1 and all other new versions of PHP . RUN docker-php-ext-configure gd --with-freetype --with-jpeg For PHP <7.3 and older version you need to use this flags: RUN docker-php-ext-configure gd
--with-png-dir=/usr/include/
--with-j