docker学习(5)—docker中安装php扩展模块gd、exif

1、进入容器
docker exec -it php /bin/bash

2、查看php当前模块
php -m

3、安装依赖包
apt-get install libwebp-dev libjpeg-dev libpng-dev zlib1g-dev libfreetype6-dev libjpeg62-turbo-dev

4、添加GD库编译选项
docker-php-ext-configure gd --with-jpeg-dir=/usr/include/

5、安装gd、exif模块
docker-php-ext-install gd

6、安装exif模块
docker-php-ext-install exif

7、重启容器
exit
docker restart php
docker restart nginx

8、查看phpinfo
出现gd模块,并且有:
JPEG Support:enabled
libJPEG Version:6b

参考资料:
https://www.azimiao.com/4903.html