安裝依賴庫
apt install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev
如果安裝時較慢,請更換國內(nèi)源
解壓源碼
docker-php-source extract
配置編譯環(huán)境
docker-php-ext-configure gd --with-webp-dir=/usr/include/webp --with-jpeg-dir=/usr/include --with-png-dir=/usr/include --with-freetype-dir=/usr/include/freetype2
編譯安裝
docker-php-ext-install gd
查看結(jié)果
php -m | grep gd